一
二
Deleted表存放由於執行Delete或Update語句而要從表中刪除的所有行
Inserted表存放由於執行Insert或Update語句而要向表中插入的所有行
三
SQL Server
Instead of觸發器用於替代引起觸發器執行的T
After觸發器在一個Insert
一個表或視圖的每一個修改動作(insert
四
如果一個Insert﹑update或者delete語句違反了約束
Instead of 觸發器可以取代激發它的操作來執行
五
基本語句如下
create trigger trigger_name
on {table_name | view_name}
{for | After | Instead of }
[ insert
as
sql_statement
六
基本語句如下
drop trigger trigger_name
七
use jxcSoftware
go
select * from sysobjects where xtype=
exec sp_helptext
八
基本語句如下
alter trigger trigger_name
on {table_name | view_name}
{for | After | Instead of }
[ insert
as
sql_statement
九
create trigger orderinsert
on orders
after insert
as
if (select status from goods
where goods
begin
print
print
rollback transaction
end
create trigger orderinsert
on orders
after insert
as
update goods set storage=storage
from goods
where
goods
create trigger goodsdelete
on goods
after delete
as
delete from orders
where goodsname in
(select name from deleted)
create trigger orderdateupdate
on orders
after update
as
if update(orderdate)
begin
raiserror(
rollback transaction
end
create trigger orderinsert
on orders
after insert
as
if (select count(*) from goods
begin
print
rollback transaction
end
alter trigger addOrder
on Orders
for insert
as
insert into Order
select inserted
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22002.html