怎么编写(如果元组超过100个则删除前面50个元组)的T-SQL语句来?
发布网友
发布时间:2024-10-08 10:46
我来回答
共1个回答
热心网友
时间:2024-10-30 16:51
declare @i int,@m int
declare t1 scroll cursor for
select * from 表
open t1
set @m= @@cursor_rows
close t1
deallocate t1
declare t cursor for
select * from 表
open t
print @m
set @i=1
if @m>3
begin
while @i<=2
begin
fetch next from t
delete bookinfo where current of t
set @i=@i+1
end
end
close t
deallocate t