A trigger is a special form of stored procedure that is executed automatically when a statement that modifies data is executed. You use triggers whenever referential integrity and other declarative constraints are insufficient. See Ensuring data integrity, and CREATE TABLE statement.
You may want to enforce a more complex form of referential integrity involving more detailed checking, or you may want to enforce checking on new data, but allow legacy data to violate constraints. Another use for triggers is in logging the activity on database tables, independent of the applications using the database.
There are three special statements that triggers do not fire after: LOAD TABLE, TRUNCATE, and WRITETEXT. See LOAD TABLE statement, TRUNCATE statement, and WRITETEXT statement [T-SQL].
Creating triggers
Executing triggers
Altering triggers
Dropping triggers
Trigger execution permissions
Advanced information on triggers
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |