BUG: Recreating a Table Causes sysdepends to Become Invalid

Last reviewed: March 18, 1997
Article ID: Q115333
4.21a 6.00 WINDOWS kbbug4.21a kbbug6.00 kbprg

The information in this article applies to:

  - Microsoft SQL Server versions 4.21a and 6.0
BUG# NT: 10215 (4.21a)

SYMPTOMS

If a stored procedure or view depends on a table that has been dropped, sysdepends will continue referencing the old ID of the table as a dependent, even if this ID does not exist any more. As a result, sp_depends will not show the correct object dependency.

WORKAROUND

Drop and recreate the stored procedure or view. The entries for sysdepends will be properly recreated.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server versions 4.21a, 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.

MORE INFORMATION

The following is an example of the problem. First, create the table and procedure referencing that table.

   create table testx (c int)
   go
   create procedure procx as select * from testx
   go
    select name, id from sysobjects where (name = "testx")
   or (name = "procx")
   go

   name                           id
   -----------------------------  ----------
   testx                          464004684
   procx                          480004741

Now drop the table, and recreate it using the same name. Then new object id.

   drop table testx
   go
   create table testx (c int)
   go
   select id from sysobjects where name = "testx"

   id
   -----------
   512004855

A query against sysdepends shows that the dependent object id is not updated.

   select id, depid from sysdepends where id = 480004741

   id          depid
   ----------  ----------
   480004741   464004684


Additional reference words: 4.21a 6.00 Windows NT


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.