BUG: Error 602 While Fetching from a Cursor Defined on a View

ID: Q165130


The information in this article applies to:

BUG#: 16646 (6.5)

SYMPTOMS

If you fetch from a cursor defined on a view owned by a user other than the owner of the underlying base table, and there are identical object names for the view and the table, you will receive the following error message, and the client connection will be terminated:

Error 602, Severity: 21, State 3
Could not find row in Sysindexes for dbid '4', object
'1232007420',index '-1'.
Run DBCC CHECKTABLE on Sysindexes.

For example, a view called "authors" created by user "Bill" in the pubs database defined on the underlying "dbo" owned "authors" table will give error 602 when Bill attempts to fetch from a cursor on this view.


CAUSE

The object ID in the error 602 message corresponds to the view object. SQL Server looks for the table object owned by its owner, when it should in fact be looking for the view.


WORKAROUND

Use qualifiers to reference the View name when declaring the cursor, as in the following example:


   [[database.]owner.]view_name 


STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server versions 6.0 and 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Keywords          : kbprg SSrvTran_SQL 
Version           : 6.0 6.5
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 9, 1999