可能是游标类型不对 create table #a(a varchar(10)) insert #a select 'a' union all select 'b' union all select 'a' union all select 'b' union all select 'c' ----------------------------------------------------------- declare a cursor local scroll_locks for select * from #a open a declare @b varchar(10) fetch a into @b while (@@fetch_status=0) begin if @b='b' delete #a where current of a fetch a into @b end close a deallocate a ------------------------------------------------------------ select * from #a
create table #a(a varchar(10))
insert #a select 'a' union all select 'b' union all select 'a' union all select 'b' union all select 'c'
-----------------------------------------------------------
declare a cursor local scroll_locks for select * from #a
open a
declare @b varchar(10)
fetch a into @b
while (@@fetch_status=0)
begin
if @b='b'
delete #a where current of a
fetch a into @b
end
close a
deallocate a
------------------------------------------------------------
select * from #a
这是不是取表中的第@i条纪录?
fetch: 提取类型 absolute 不能用于只进游标。但是不用只进游标又会出现这种服务器: 消息 16929,级别 16,状态 1,过程 pro_TestTuples,行 46
游标是 READ ONLY 的。
该怎么办啊?