注册 登录
编程论坛 SQL Server论坛

关于游标问题!谢谢

w5644266 发布于 2007-04-26 10:17, 703 次点击
declare @storid char(4),
declare @ordnum varchar(20),
declare @orddate datetime,
declare @titleid tid
declare curSales scroll cursor
for
select stor_id,ord_num,,ord_date,title_id
from sales
for read only
open curSales
fetch next from curSales into
@storid ,
@ordnum ,
@orddate,
@titleid
where @@fetch_status=0
begin
print +@storid
print +@ordnum
print +@orddate
print +@titleid
print ''
fetch next from curSales into
@storid ,
@ordnum ,
@orddate,
@titleid
end
close curSales
为什么不能通过呢!我看没有语法错误啊!
这是pubs数据库里的sales表

[此贴子已经被作者于2007-4-26 10:24:28编辑过]

2 回复
#2
从小到大2007-04-26 10:51
where @@fetch_status=0 改成while看看
#3
w56442662007-04-27 07:28

谢谢

1