Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 List of Triggers with Table name and Table owner name

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-02-16 : 07:44:07
David writes "I need to import a lot of data into a database so I need to disable all the constraints that are currently enabled and all the triggers that are currently enabled.

I am having a problem getting a list of triggers that are enabled along with the table owner and the table name.


Here is what I have so far.


select
"Table"=P.Name,
"Trigger Name"=O.name,
"Trigger Date"=O.refdate,
"Defn"=CASE C.encrypted WHEN 0 THEN C.text ELSE '<< ENCRYPTED >>' END
from
syscomments C
INNER JOIN sysobjects O ON (C.id = O.id)
INNER JOIN sysobjects P ON (O.parent_obj = P.id)
where

O.xtype = 'TR' "

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-02-16 : 23:05:08
Try this..
select a.name triggername,object_name(a.parent_obj) tablename ,b.name owner from sysobjects a
inner join sysusers b
on a.uid= b.uid
where a.xtype = 'TR'
Go to Top of Page
   

- Advertisement -