34,838
社区成员




declare ap cursor for
select [字段列表] from
(select *,row_number() over(order by getdate()) 'rn' from SPJ) t
where t.rn%2=0
open ap
fetch first from ap into [变量列表]
while(@@fetch_status<>-1)
begin
[处理代码]
fetch next from ap into [变量列表]
end
close ap
deallocate ap
with t
as
(
select *,ROW_NUMBER() OVER(order by (select 1)) as num
from SPJ
)
select * from t where num%2 = 0