What is Trigger in Sql Server?

Total Post:49

Points:345
 158  View(s)
Ratings:
Rate this:

Please Give me a suitable Example. 

  1. Post:281

    Points:2003
    Re: What is Trigger in Sql Server?

    A trigger is a special type of a stored procedure that’s rise in the response at the certain action on the table like insert, update, and delete of data. It is executed automatically. You can’t explicitly invoke triggers. The only way to do this is by performing the required action on the table that they are assigned to.

    Example:-

    CREATE TRIGGER Delete_Products
    
    ON Product
    Instead Of
    Delete
    AS
    Print “You are Not Allowed to delete Record”.
    -------------
    Create Trigger Insert_Products
    ON Products
    AFTER
    INSERT
    AS
    PRINT “Record Inserted in the Products table”

    What is Trigger in Sql Server?

Answer