34,874
社区成员
发帖
与我相关
我的任务
分享
概念我都知道,只是想问下经验,一般用在什么地方,和什么情况下不用。
[Quote=引用 17 楼 fredrickhu 的回复:]create table tb(id int)
create trigger tr_name on tb
for insert
as
if(select id from inserted)=1
return
else
insert into tb select 100
insert into tb select 0
select * from tb
/*id
-----------
0
100
(2 行受影响)*/
insert into tb select 1
select * from tb
/*
id
-----------
0
100
1
(3 行受影响)*/