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.
Author |
Topic |
Jas Jr
Starting Member
5 Posts |
Posted - 2012-04-09 : 08:43:40
|
Hi All,I have table with 6 triggers on it.i use ALTER TABLE TABL_NAME DISABLE TRIGGER ALL to disable all the trigers on the table for some updation and then enable all the triggers using ALTER TABLE TABL_NAME ENABLE TRIGGER ALL. Later i find out that only 4 of the 6 triggers were actually enabled before i did my stuff. Although, I have disable the triggers that should be but i need help how to check out that how many active triggers are there on the table and what should be the sql to disable and enable only the active triggers on a table. Thanks in advance. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-09 : 11:26:40
|
to get enabled triggers on table useSELECT name FROM sys.triggers WHERE OBJECT_NAME(Parent_Id) = <your table name>AND is_disabled =0 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
Jas Jr
Starting Member
5 Posts |
Posted - 2012-04-10 : 00:33:15
|
Thanks a lot visakh, it works.Please share how can i disable and enable triggers that are already enabled on a table without hitting the triggers that are already disabled. Thanks a lot once again. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-10 : 16:18:20
|
you can use disable trigger to disbale the already enabled triggers whose list you'll get from last suggestionhttp://msdn.microsoft.com/en-us/library/ms189748.aspxand to enable them back use ENABLE TRIGGERhttp://msdn.microsoft.com/en-us/library/ms182706(v=sql.100).aspx------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
Jas Jr
Starting Member
5 Posts |
Posted - 2012-04-12 : 02:01:32
|
Thanks man!! |
 |
|
|
|
|