SQLSERVER 一个简单的游标应用

declare test_cursor cursor scroll for select id from member
open  test_cursor
declare @id int
while @@FETCH_STATUS=0
begin
print @id
update member set mobile = cast(rand()*100000000000 as bigint) where id=@id ;
fetch next from test_cursor into @id
end
close test_cursor
deallocate test_cursor

猜你喜欢

转载自douglozy.iteye.com/blog/2254175