[size=14px]
[size=13px]我假设有两张表s 和t ,s和t都有两列
s:sid ,sname
t:tid ,tname
其中s表是临时存放数据的表,由一个程序将s表中的数据读出后就把该数据删除了
我想用t表将曾经放在s表中的数据永久保存下来
即,在数据插入s表后,被删除之前将数据复制到t表中
各位大哥帮帮忙!!!急![/size][/size]
7 个解决方案
#1
CREATE TRIGGER TIR_DEL ON S
FOR DELETE
AS
INSERT T SELECT * FROM DELETED
#2
create trigger tri_delete
on S
for delete
as
begin
insert into t
select * from deleted
end
#3
create trigger trig_s_insert on s
for insert as
insert t select * from inserted
#4
那就在S表做一个触发器,删除的时候保存记录到T表:
create trigger tg on s
for delete
as
insert t select * from delete
#5
数据插入s表后,被删除之前.
按照意思,应该用insert触发器。
其实,insert和delete触发器都可以的。
#6
谢谢各位
#7
create trigger tg on s
for delete
as
insert t select * from delete
create trigger trig_s_insert on s
for insert as
insert t select * from inserted
这两种,我都试了,可是还是不行啊!!!
求助啊!在线等
for delete
as
insert t select * from delete
create trigger trig_s_insert on s
for insert as
insert t select * from inserted
这两种,我都试了,可是还是不行啊!!!
求助啊!在线等
#1
CREATE TRIGGER TIR_DEL ON S
FOR DELETE
AS
INSERT T SELECT * FROM DELETED
#2
create trigger tri_delete
on S
for delete
as
begin
insert into t
select * from deleted
end
#3
create trigger trig_s_insert on s
for insert as
insert t select * from inserted
#4
那就在S表做一个触发器,删除的时候保存记录到T表:
create trigger tg on s
for delete
as
insert t select * from delete
#5
数据插入s表后,被删除之前.
按照意思,应该用insert触发器。
其实,insert和delete触发器都可以的。
#6
谢谢各位
#7
create trigger tg on s
for delete
as
insert t select * from delete
create trigger trig_s_insert on s
for insert as
insert t select * from inserted
这两种,我都试了,可是还是不行啊!!!
求助啊!在线等
for delete
as
insert t select * from delete
create trigger trig_s_insert on s
for insert as
insert t select * from inserted
这两种,我都试了,可是还是不行啊!!!
求助啊!在线等