@@FETCH_STATUS in SQL Server
It returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.
FETCH can return following three values
a) 0 if the the FETCH statement was successfully find the next row.
b) -1 if the FETCH statement failed or the row was beyond the result set.
c) -2 if the row fetched is missing. It can happen if some has deleted the row after opening the cursor.
After a FETCH statement is executed, the test for @@FETCH_STATUS must occur before any other FETCH statement is executed against another cursor.
To retrieve the last fetch status of a specific cursor, query the fetch_status column of the sys.dm_exec_cursors dynamic management function.
Pawan Kumar
great.. that is helpful. thanks
LikeLike
Thank you
LikeLike
Thank you !
LikeLike
Pingback: Contents « In Microsft Technologies