Monday, September 24, 2012

SQL Trigger


What is Trigger?

It is a special kind of stored procedure that executes automatically when a user attempts the specified data-modification statement on the specified table. 
 Syntax for creating aTRIGGER:

(BEFORE)_tableName_(INSERT|UPDATE|DELETE)
(AFTER)_tableName_(INSERT|UPDATE|DELETE)

The listed below are the restrictions for creating a trigger

      1. It is not allowed to create a trigger for views or temporary table.
      2. It is not allowed to use transaction in a trigger.
      3. Return statements is disallowed in a trigger.
      4. Creating a trigger for a database table causes the query cache invalidated.
      5. All trigger for a database table must have unique name


No comments:

Post a Comment