为了防止数据被删除,需要在删除数据(delete)的时候,,把要删除的数据对应表中的字段a设计为1,,然后不执行删除
这个要怎么做,郁闷了
------解决方案--------------------
在删除触发器中插入你删除的行数据,新增时a为1
insert into yourtable(col1,a) select col1,1 from deleted
------解决方案--------------------
- SQL code
create table t5( id int identity(1,1), a int)insert into t5 values(0)insert into t5 values(2)insert into t5 values(3)create trigger tri_t_don t5instead of deleteasdeclare @i intselect @i=id from deletedupdate t5 set a=1 where [email protected]---------------------------------------执行这个看看:delete from t5 where id=1select * from t5