Hi, How can I reset the @@FETCH_STATUS variable or set it to 0 in a stored procedure?
A:
You can reset it by reading a cursor which is not at the end of a table.
Sklivvz
2008-10-04 15:44:59
Another related question I have is can you bind FETCH_STATUS to a particular cursor?
test
2008-10-04 15:53:09
A:
Another related question I have is can you bind FETCH_STATUS to a particular cursor?
test
2008-10-04 15:49:50
+1
A:
You can't:
@@FETCH_STATUS (Transact-SQL)
Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.
So basically it's not bound to any cursor.
Sklivvz
2008-10-04 16:04:31
A:
As Sklivvz wrote you cannot.
But I am wondering why do you want to reset it?
What is the real problem?
Grzegorz Gierlik
2008-10-07 22:30:54
A:
Typically you have a @@FETCH_STATUS immediately after a FETCH, so why would you want to reset it?
Try to store its result in a temporary variable if you do not evaluate immediately.
devio
2008-10-07 22:40:01