SQL Server的游标

SQL中的游标,可以用在过程或者作业中。

Declare @eventid varchar(50
Declare cur_name cursor for 
select --Selectxxxxxxxx --定义游标 

open cur_name --打开游标 
fetch next from cur_name into @eventid --将name字段存到@name变量中 
while @@fetch_status=0 --执行成功 
begin 
--其他的操作!在这!
fetch next from cur_name into @eventid 
end 
close cur_name --关闭游标 
deallocate cur_name --销毁游标

这是把结果分行输出~留个笔记。

posted on 2008-02-14 13:50 LiAnGcAt 阅读(27) 评论(0) 编辑 收藏

导航

<2008年2月>
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678

公告

昵称:LiAnGcAt
园龄:5年6个月
粉丝:0
关注:0

搜索

 
 

常用链接

我的标签

随笔分类

随笔档案

4

最新评论

阅读排行榜

评论排行榜

推荐排行榜