介绍一种很好的在MSSQLSERVER创建和使用动态游标方法

pbdesigner 2001-08-10 12:31:54
加精
我写过一篇《SQLSREVER如何创建和使用动态游标》的文档(http://www.csdn.net/develop/read_article.asp?id=8799),但比起下述方法就差多了。有兴趣的可以到http://www.chinaasp.com去看看,有很多使用技巧在。
declare @sqlExec varchar(8000)
select @sqlExec = 'declare cursor1 cursor for ' + CHAR(13)
select @sqlExec = @sqlExec + ' select * from sysobjects'
exec(@sqlExec)
open cursor1
fetch next from cursor1 ---如果要放在变量中请写into <变量列表>
while @@fetch_status = 0
begin
fetch next from cursor1 ---如果要放在变量中请写into <变量列表>
end
close cursor1
deallocate cursor1
...全文
104 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
new_life 2001-10-27
  • 打赏
  • 举报
回复
gz
pbsql 2001-08-10
  • 打赏
  • 举报
回复
多谢!
PBVC 2001-08-10
  • 打赏
  • 举报
回复
gz
pbdesigner 2001-08-10
  • 打赏
  • 举报
回复
up

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧