小青龙汤歌诀,wep 破解,蔡顶伦
create trigger tri_wk_csvhead_history on wk_csvhead_history
--声明一个tri_wk_csvhead_history触发器,
instead of insert ---插入操作被代替执行下面的操作
as
begin
declare yb cursor --声明一个游标
for
select noteno from inserted--这里的noteno要和下面的匹配
open yb
declare @noteno varchar(50)--这里的noteno要和上面的匹配,定义一个游标变量@noteno,用来操作insered表中的noteno.
fetch next from yb into @noteno--这里的noteno要是上面的匹配,移动游标
while(@@fetch_status=0)--0操作成功,-1 fetch 语句失败或此行不在结果集中,-2 被提取的行不存在
begin
delete from wk_csvdetail_history where noteno=@noteno
delete from wk_csvhead_history where noteno=@noteno
fetch next from yb into @noteno --继续移动游标,直到@@fetch_status不等于时.
end
close yb --关闭游标
deallocate yb --释放游标
insert into wk_csvhead_history select * from inserted
end
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
sql某个日期是当年的第几周
/* *周一作为一周的开始 *当年的1月1号所在的周算作第一周 */ CREATE function GetWeekIndexFirstDate ( @...
[阅读全文]
-
-
数据库SQL---范式
1、数据冗余导致的问题:冗余存储、更新异常、插入异常、删除异常。 2、函数依赖:一种完整性约束。 在关系模式r(R)中,α属于R,β属于R。 1)α函数...
[阅读全文]
-
-
数据库SQL---查询
1、查询所有列 select *from emp;--*表示所有的,from emp表示从emp表中查询。 2、查询指定列 select empno,e...
[阅读全文]
-
-
-
-
-
网友评论