Types of trigger events:
There are typically three triggering events that cause data triggers to 'fire':
a) INSERT event (as a new record is being inserted into the database).
b) UPDATE event (as a record is being changed).
c) DELETE event (as a record is being deleted).
Trigger Syntax:
CREATE TRIGGER
trigger_name
ON
{table | view }
{ {
{ FOR | AFTER | INSTEAD OF } { [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] }
[ WITH APPEND ]
AS
[ { IF UPDATE ( column )
[ { AND | OR } UPDATE ( column ) ] [ ...n ]
| IF ( COLUMNS_UPDATED ( ) { bitwise_operator } updated_bitmask )
{ comparison_operator } column_bitmask [ ...n ]
} ]
sql_statement [ ...n ]
}}
There are typically three triggering events that cause data triggers to 'fire':
a) INSERT event (as a new record is being inserted into the database).
b) UPDATE event (as a record is being changed).
c) DELETE event (as a record is being deleted).
Trigger Syntax:
CREATE TRIGGER
trigger_name
ON
{table | view }
{ {
{ FOR | AFTER | INSTEAD OF } { [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] }
[ WITH APPEND ]
AS
[ { IF UPDATE ( column )
[ { AND | OR } UPDATE ( column ) ] [ ...n ]
| IF ( COLUMNS_UPDATED ( ) { bitwise_operator } updated_bitmask )
{ comparison_operator } column_bitmask [ ...n ]
} ]
sql_statement [ ...n ]
}}
0 comments:
Post a Comment