BUG: Recreating a Table Causes sysdepends to Become Invalid

Article translations Article translations
Article ID: 115333 - View products that this article applies to.
This article was previously published under Q115333
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 10215 (4.21a)
BUG #: 16652 (SQLBUG_65)
BUG #: 57903 (SQLBUG_70)
BUG #: 56127 (SHILOH)
Expand all | Collapse all


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.


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


Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


The following is an example of the problem. First, create the table and procedure referencing that table.
   create table testx (c int)
   create procedure procx as select * from testx
    select name, id from sysobjects where (name = "testx")

   or (name = "procx")

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

Now drop the table, and recreate it using the same name. Then new object id.
   drop table testx
   create table testx (c int)
   select id from sysobjects where name = "testx"


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


Article ID: 115333 - Last Review: February 28, 2014 - Revision: 3.3
  • Microsoft SQL Server 4.21a Standard Edition
  • Microsoft SQL Server 6.0 Standard Edition
  • Microsoft SQL Server 6.5 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 2000 Standard Edition
kbnosurvey kbarchive kbbug KB115333

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com