📄 trigger_rkzb_update.sql
字号:
alter trigger dba.Trigger_rkzb_update on
DBA.ck_rkzb for update
--REFERENCING [ OLD AS old_name ]
-- [ NEW AS new_name ]
--FOR EACH ROW
as --[ WHEN( search_condition ) ]
begin
declare @dh char(10),@lh char(40),@hch char(2),@rksl numeric(20,3)
select @dh = dh from inserted
begin
declare my_cursor dynamic scroll cursor for select hch,lh,sl from ck_rkmxb where dh = @dh
open my_cursor
fetch next my_cursor into @hch,@lh,
@rksl
while @@sqlstatus = 0
begin
if(select count(*) from jb_kcb where hch = @hch and lh = @lh) > 0
begin
update jb_kcb set kcsl = isnull(kcsl,0)+@rksl where hch = @hch and lh = @lh
end
else
begin
insert into jb_kcb(hch,lh,kcsl) values(@hch,@lh,@rksl)
end
fetch next my_cursor into @hch,@lh,
@rksl end
close my_cursor
deallocate cursor my_cursor
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -