Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How Can I find the number of rows selected by a Cu

Author  Topic 

khufiamalik
Posting Yak Master

120 Posts

Posted - 2008-08-21 : 01:12:24
Hello all,
How Can I find the number of rows selected by a Cursor before opening it.
and secondly if I do not do , will Cursor give error When the select query returns 0 row?


Thanks

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2008-08-21 : 02:13:26
1.U can get the count by using @@ROWCOUNT after the Cursor Declare statement.
From BOL--
After the cursor is opened, the @@CURSOR_ROWS function or the cursor_rows column returned by sp_cursor_list or sp_describe_cursor indicates the number of rows in the cursor.

2.U dont get any error if the returned rows are 0
Go to Top of Page
   

- Advertisement -