See “Triggers and transactions” for a list of statements that are not allowed in a trigger definition.
See “The deleted and inserted logical tables” for information about the deleted and inserted logical tables that can be included in trigger definitions.
Permissions on objects at trigger execution – When the trigger executes, permission checks on its objects depend on whether the trigger and its objects are owned by the same user.
Permissions for instead of and for triggers instead of – instead of triggers have the same permission requirements as for triggers: to create a view with instead of triggers, permission for insert/update/delete for the view, not the underlying tables, must be granted to the user.
The SQL statements often include a subquery preceded by the keyword if.
In Example 2, below, the subquery that follows the keyword if is the trigger condition.
" end if update (price) or update (advance) if (select count (*) from inserted where (inserted.price * inserted.total_sales) create table Employee West ( empid int primary key, empname varchar(30), empdob datetime, region char(5) constraint region_chk check (region='West')) create table Employee East ( empid int primary key, empname varchar(30), empdob datetime, region char(5) constraint region_chk check (region='East’)) create view Employees as select * from Employee East union all select * from Employee West create trigger Employees Insert Trig on Employees instead of insert as begin insert into Employee East select * from inserted where region = "East" insert into Employee West select * from inserted where region = "West" end --will insert the data into the Employee East table insert into Employees values (10, 'Jane Doe', '11/11/1967', 'East') --will insert the data into the Employee West table insert into Employees values (11, 'John Smith', '01/12/1977', 'West') --will insert multiple rows into Employee East and --Employee West tables.