If you change the name of an object referenced by a trigger, you must drop the trigger and re-create it so that its text reflects the new name of the object that it references. To avoid problems, re-create a trigger that references any tables or views that you rename.
The sp_depends system procedure lists all the triggers that reference the object (for example, table or view) or all the tables or views that the trigger affects. This example shows how to use sp_depends to get a list of all the objects referenced by the trigger deltrig:
sp_depends deltrig In the current database the specified object references the following:
name |
type |
updated |
selected |
--------- |
---------- |
------- |
-------- |
dbo.sales |
user table |
yes |
yes |
(1 row(s) affected)
This statement lists all the objects that reference the sales table:
sp_depends sales In the current database the specified object references the following:
name |
type |
------------ |
--------------- |
dbo.conditionalinsert |
trigger |
(1 row(s) affected)