--这个意思? create table tb(a int,b int,c int) insert into tb select 1,2,3 insert into tb select 4,4,5 insert into tb select 6,7,8 gocreate trigger cfq on tb for insert,update asif @@rowcount=0 returnif exists(select 1 from sysobjects where id=object_id('ta') and xtype='u') drop table taselect a.a,(select count(*) from tb where a=a.a) as 行数 into ta from inserted a group by a.a goinsert into tb select 1,2,3 select * from tb select * from ta goupdate tb set a=3 where a=1 select * from tb select * from ta godrop trigger cfq drop table tb,ta
create table tb(a int,b int,c int)
insert into tb select 1,2,3
insert into tb select 4,4,5
insert into tb select 6,7,8
gocreate trigger cfq on tb
for insert,update
asif @@rowcount=0 returnif exists(select 1 from sysobjects where id=object_id('ta') and xtype='u')
drop table taselect a.a,(select count(*) from tb where a=a.a) as 行数 into ta from inserted a group by a.a
goinsert into tb select 1,2,3
select * from tb
select * from ta
goupdate tb set a=3 where a=1
select * from tb
select * from ta
godrop trigger cfq
drop table tb,ta