Purpose of the following Trigger
---------------------------------
--AVOIDE TO DROP TABLES FROM DATABASE
USE Test_Manoj
Go
CREATE TRIGGER TRG_DB_SAFTY
ON DATABASE
FOR DROP_TABLE
AS
RAISERROR('DROP CANNOT POSSIBLE,PLEASE CONTACT ADMIN..',16,1)
ROLLBACK ;
After creation of trigger any point of time a trigger can be disable or enable by the user.For Disable a trigger(de-activate) DISABLE keyword is used as follows:-
--Disable Trigger on Database
USE Test_Manoj
Go
disable TRIGGER TRG_DB_SAFTY on database
For Enable a trigger on Database,any other object we need ENABLE keyword as follows:-
--Enable trigger on Database
USE Test_Manoj
Go
ENABLE TRIGGER TRG_DB_SAFTY on database
Disabling all triggers
------------------------------Disable all triggers on all server
USE Test_Manoj
Go
DISABLE Trigger ALL ON ALL SERVER
OR
--Disable all triggers in Database
USE Test_Manoj
Go
DISABLE Trigger ALL ON DATABASE
Go
Disable Trigger on Table
---------------------------------
USE Test_Manoj
Go
DISABLE Trigger ALL ON DBO.MY_EMP
Go
Posted By:-javadevelopersguide
Link:-http://javadevelopersguide.blogspot.com
No comments:
Post a Comment