Search code examples
sql-serversql-server-2000

mssql 2008 r2 - How to remove and add dependencies to a table using query or stored procedures?


How to remove and add dependencies to a table using query or stored procedures?

Basically I have a table called A and it has a stored procedure dependency called B.

I want to create a new table called C and add the stored procedure dependency to C and Delete A.


Solution

  • Are you trying to do this without modifying the stored procedure? Technically you could do this using a SYNONYM (DROP TABLE dbo.A; CREATE SYNONYM dbo.A FOR dbo.C;) - assuming you are on SQL Server 2005 or higher (please specify your version!) - but this can become a nightmare of spaghetti and cascading references.