Instead Of Triggers in SQL SERVER 2005 and it's Syntax

Instead of trigger executes the code inside of the trigger instead of an Insert/delete/update commands.But we can write a code to insert/delete/update row inside the trigger.
    Instead of Triggers can be classified into 3 types.
    1.INSTEAD Of INSERT Trigger
    2.INSTEAD Of UPDATE Trigger
    3.INSTEAD Of DELETE Trigger

    Syntax:
    CREATE TRIGGER trgInsteadOf  ON [dbo].[Table_Name]
    INSTEAD OF DELETE /*Here we can use UPDATE or DELETE also for  INSTEAD OF UPDATE and INSTEAD OF DELETE Triggers*/
    AS
     -- write sole logic
    PRINT 'Instead Of Trigger fired.'
    GO

No comments:

Post a Comment