declare @l_id varchar(50)
declare @lname varchar(50)
declare @fname varchar(50)
declare @cur_update cursor
set @cur_update= cursor for select * from author
open @cur_update
fetch next from @cur_update into @l_id,@lname,@fname
while (@@fetch_status=0)
begin
if (@l_id='172-32-1176')
begin
update author set au_lname='Smith' where CURRENT OF @cur_update
update author set au_fname='Jake' where CURRENT OF @cur_update
end
fetch next from @cur_update into @l_id,@lname,@fname
end
CLOSE @cur_update
DEALLOCATE @cur_update
go
declare @lname varchar(50)
declare @fname varchar(50)
declare @cur_update cursor
set @cur_update= cursor for select * from author
open @cur_update
fetch next from @cur_update into @l_id,@lname,@fname
while (@@fetch_status=0)
begin
if (@l_id='172-32-1176')
begin
update author set au_lname='Smith' where CURRENT OF @cur_update
update author set au_fname='Jake' where CURRENT OF @cur_update
end
fetch next from @cur_update into @l_id,@lname,@fname
end
CLOSE @cur_update
DEALLOCATE @cur_update
go
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货