LOGO

LOGO
LOGO
ads header

Breaking News

TRIGER DISABLE VEYA ENABLE


Disable all the triggers for a single database:
USE AdventureWorks;GO
DISABLE 
TRIGGER Person.uAddress ONAdventureWorks;GO




Disable all the triggers for all servers:
USE AdventureWorks;GO
DISABLE 
TRIGGER ALL ON ALLSERVER;GO




sp_MSforeachtable "ALTER TABLE ? DISABLE TRIGGER ALL"

To Enable All the Triggers
sp_MSforeachtable "ALTER TABLE ? ENABLE TRIGGER ALL"


use MyDatabase
sp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER all'
To enable all triggers, you can use following statement
use MyDatabase
sp_msforeachtable 'ALTER TABLE ? ENABLE TRIGGER all'


Disable or Enable all Triggers on a Table

If you need to bring a copy of the database from production to another environment, you may want to disable all the triggers for all tables. Here is a simple syntax you can use to accomplish this. First you could specify the specific table(s) for which you want to disable triggers.
ALTER TABLE [dbo].[MyTable] DISABLE TRIGGER ALL
The re-enable all triggers just use this syntax.
ALTER TABLE [dbo].[MyTable] ENABLE TRIGGER ALL
Finally, if you don't want to specify the tables (perhaps because you have triggers on many tables) then just use sp_msforeachtable.
EXEC sp_msforeachtable "ALTER TABLE ? DISABLE TRIGGER ALL"

Hiç yorum yok