【SQL开源代码栏目提醒】:网学会员为广大网友收集整理了,实例336基于游标定位修改员工信息表中员工的姓名.sql,希望对大家有所帮助!
declare @id char(20)
declare @ids char(20)
declare @names char(20)
set @id='CDD001'
declare a_cursor cursor
for select 员工编号, from tb_update16
open a_cursor
fetch next from a_cursor
into @ids,@names
while @@fetch_status=0
begin
if @id=@ids
begin
update tb_update16 set ='小陈丹' where 员工编号=@ids
end
fetch next from a_cursor
into @ids,@names
end
close a_cursor
deallocate a_cursor
select * from tb_update16