February 16, 2011 at 5:43 pm
Hi All,
Is there a way to get the count of number of rows processed by a cursor.
Thanks in advance.
February 21, 2011 at 2:52 pm
You could create a variable and increment it on each pass through the cursor. Of course the preferred method would be to rework your code to a set based approach and get rid of the cursor entirely.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
February 21, 2011 at 3:23 pm
If it's in a separate "batch", you can probably get a fairly good idea of the rowcount using SQL Profiler. It won't be as perfect as putting a counter in the code like Sean suggested, though.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply