title: Slow Query in SQL - CXCONSUMER Wait Type
body: <p>I have a Data Script, It executed about 3 minutes in a database, but when I try to execute that on another database (Different Servers) It takes more than 4 hours so I kill it.
  when I get Server state the query is in wait (CXCONSUMER type) from first second. and Who_2 shows 25 Records with Cmd = OPEN CURSOR and 24 Status = suspended and 1 status = runnable.
  How can I turn off parallelism in sql and run my script?</p>
  <pre><code>declare @PolicyId int, @ElhNo int, @Y int, @CapitalChangeZarib decimal(38, 10), @PrmChangeZarib decimal(38, 10)
  declare PayPeriodCursor cursor local for
      select Distinct CurrBNVer.PolicyId, CurrBNVer.ElhNo, CurrBNVer.Y, CurrBNVer.CapitalChangeZarib, CurrBNVer.PrmChangeZarib
      from v_Table1 CurrBNVer 
          left join v_Table1 PreBNVer on CurrBNVer.PolicyId = PreBNVer.PolicyId and
                                                      CurrBNVer.ElhNo - 1 = PreBNVer.ElhNo        
      order by CurrBNVer.PolicyId, CurrBNVer.ElhNo
  open PayPeriodCursor 
  fetch next from PayPeriodCursor into @PolicyId, @ElhNo, @Y, @CapitalChangeZarib, @PrmChangeZarib
  while @@FETCH_STATUS = 0 
  begin 
      update Table2
      set Filed1= 0.01 * @CapitalChangeZarib, 
          Filed2= 0.01 * @PrmChangeZarib
      where PolicyId = @PolicyId and
            ElhNo &gt;= @ElhNo and
            Year &gt;= ISNULL(@Y, 0)
      fetch next from PayPeriodCursor into @PolicyId, @ElhNo, @Y, @CapitalChangeZarib, @PrmChangeZarib
  end
  close PayPeriodCursor
  deallocate PayPeriodCursor 
  
  go
  </code></pre>