首页 > 代码库 > 存储过程游标应用

存储过程游标应用

CREATE PROCEDURE userinfor2
@id int,
@UserID int output
AS
BEGIN
declare youbiao(游标名) cursor for select id from UserInfor where id=@id
declare @getid varchar(400)
open youbiao(游标名)
begin
fetch next from youbiao(游标名) into @getid (赋值)
update UserInfor set name=‘‘+@getid+‘‘+‘111‘ where id=@getid
end
close youbiao 
deallocate youbiao
return @UserID
END

存储过程游标应用