BUG: Cursor Fetch Within Stored Procedure Behavior Inconsistent (155220)
The information in this article applies to:
This article was previously published under Q155220 SYMPTOMS
When cursor is declared and fetched within stored procedure, "Fetch Cursor"
displays inconsistent behavior between DYNAMIC and SCROLLABLE cursors.
"FETCH NEXT FROM cursor INTO @variables" with DYNAMIC cursor results in the
"0 row(s) affected" message, while the SCROLLABLE cursor does not return
any message.
Because the default behavior for cursor has changed from "KEYSET DRIVEN (or
SCROLLABLE)" in SQL Server 6.0 to "DYNAMIC" in SQL Server 6.5, this appears
to users as stored procedure behavior changes from SQL Server 6.0 to SQL
Server 6.5.
NOTE: In DYNAMIC cursor, DONE_INPROC bit is not set when "FETCH" is
executed, therefore it always returns the 0 row count.
WORKAROUND
Create the cursor as "SCROLL CURSOR" or use "SET NOCOUNT ON" within the
stored procedure, so that you do not receive the "0 row(s) affected"
message.
STATUS
Microsoft has confirmed this to be a problem in Microsoft SQL Server
version 6.5. We are researching this problem and will post new information
here in the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 10/3/2003 |
---|
Keywords: | kbBug kbProgramming KB155220 |
---|
|