第一个游标

[ 2007-8-29 16:32:00 | By: 99love ]

declare f_cur cursor for select [id],[status] from dbo.paypal for update of status;

declare @id bigint

declare @status bit

open f_cur

fetch next from f_cur into @id,@status

while(@@fetch_status=0)

begin

    print 'id:'+cast(@id as varchar)+', status:'+cast(@status as varchar)

    update dbo.paypal set status=~status where current of f_cur

    fetch next from f_cur into @id,@status

end

close f_cur

deallocate f_cur

发表评论:

    密码:
    主页:
    标题:
    页面数据正在载入...
bxna 京ICP备05002321号