News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

@@CURSOR_ROWS

Started by sukishan, Aug 18, 2009, 08:04 PM

Previous topic - Next topic

sukishan

@@CURSOR_ROWS
Returns the number of qualifying rows currently in the last cursor opened on the connection. To improve performance, Microsoft® SQL Server™ can populate large keyset and static cursors asynchronously. @@CURSOR_ROWS can be called to determine that the number of the rows that qualify for a cursor are retrieved at the time @@CURSOR_ROWS is called.

Syntax
@@CURSOR_ROWS

Return Types
integer

Remarks
The number returned by @@CURSOR_ROWS is negative if the last cursor was opened asynchronously. Keyset-driver or static cursors are opened asynchronously if the value for sp_configure cursor threshold is greater than 0, and the number of rows in the cursor result set is greater than the cursor threshold.

Examples
This example declares a cursor and uses SELECT to display the value of @@CURSOR_ROWS. The setting has a value of 0 before the cursor is opened, and a value of -1 to indicate that the cursor keyset is populated asynchronously.

SELECT @@CURSOR_ROWS
DECLARE authors_cursor CURSOR FOR
SELECT au_lname FROM authors
OPEN authors_cursor
FETCH NEXT FROM authors_cursor
SELECT @@CURSOR_ROWS
CLOSE authors_cursor
DEALLOCATE authors_cursor

-----------
0           

(1 row(s) affected)

au_lname                                 
----------------------------------------
White                                   

(1 row(s) affected)

           
-----------
-1         

(1 row(s) affected)
A good beginning makes a good ending

pradeep prem

with this cursor solve syntax its has easy to recover