设为首页 加入收藏

TOP

自己写的游标操作语句(三)
2014-11-23 22:13:40 来源: 作者: 【 】 浏览:31
Tags:自己 游标 操作 语句
FID
www.2cto.com
end
close topic_cursor
deallocate topic_cursor
--更新论坛 dnt_posts1的fid
declare post_cursor cursor scroll
for
SELECT [pid],[fid] from [nsd_forum_discuz25].[dbo].[dnt_posts1] where pid<>0 ORDER BY pid
open post_cursor
declare @pid int
fetch next from post_cursor into @pid,@fid
while(@@fetch_status=0)
www.2cto.com
begin
update [nsd_forum_discuz25].[dbo].[dnt_posts1] set fid=(select fid from [nsd_forum_discuz25].[dbo].[dnt_forums] where oldfid=@fid) where pid=@pid
--print str(@parentid)
fetch next from post_cursor into @pid,@fid
end
close post_cursor
deallocate post_cursor
作者 ctz168
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇SQL游标语法及举例 下一篇SQL SERVER通过游标查询两个数据..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: