declare my_cursor cursor scroll dynamic
/*scroll表示可随意移动游标指针(否则只能向前),dynamic表示可以读写游标(否则游标只读)*/
for
select * from t_msg
open my_cursor
declare @name sysname
fetch next from my_cursor into @name
while(@@fetch_status=0)
begin
print 'UserName: ' + @name
--fetch next from my_cursor
fetch next from my_cursor into @name
end
--fetch first from my_cursor into @name
print @name
/* update 个人资料 set 姓名='zzg' where current of my_cursor */
/* delete from 个人资料 where current of my_cursor */
close my_cursor
deallocate my_cursor
/*scroll表示可随意移动游标指针(否则只能向前),dynamic表示可以读写游标(否则游标只读)*/
for
select * from t_msg
open my_cursor
declare @name sysname
fetch next from my_cursor into @name
while(@@fetch_status=0)
begin
print 'UserName: ' + @name
--fetch next from my_cursor
fetch next from my_cursor into @name
end
--fetch first from my_cursor into @name
print @name
/* update 个人资料 set 姓名='zzg' where current of my_cursor */
/* delete from 个人资料 where current of my_cursor */
close my_cursor
deallocate my_cursor