赤壁之战课文mp3:sql server2000 关于触发器和游标的问题

来源:百度文库 编辑:高考问答 时间:2024/04/29 08:29:48
create trigger zjmcbchange
on zjmcb
for insert,update
as
declare @bm varchar(8), @i decimal(18,3), @j decimal(18,3),@b bit
declare tmp cursor
for
select a.jqbm,b.yjcb,b.sjcb,b.zt from inserted a,zjmcb b
where a.jqbm=b.jqbm
for update
open tmp
fetch next from tmp
into @bm,@i,@j,@b
WHILE @@FETCH_STATUS = 0
begin
if @i is null and @j is null
update zjmcb set zt=0 where current of tmp
if @i is not null and @j is null
update zjmcb set zt=1 where current of tmp
if @j is not null
update zjmcb set zt=2 where current of tmp
fetch next from tmp
close tmp
deallocate tmp
end
这段代码哪有问题?为什么说我的游标是只读的呢?