Quantcast
Viewing all articles
Browse latest Browse all 9

Cursor Question

 

Initially the @@FETCH_STATUS gets 0 and the loop was executed.

At the end of the loop, @@FETCH_STATUS becomes -1 as the loop is terminated.

For the second run @@FETCH_STATUS retains -1 (from the previous execution) and the loop is skipped.

 

Do a fetch before the loop to reset the @@FETCH_STATUS

 

 

fetch next from db_cursor2

while @@FETCH_STATUS = 0

begin

  fetch next from db_cursor2 

end

 


The simpler the solution the stronger it is
If this post answers you, please mark it as answer..
If this post is useful, please vote it as useful..

Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>