34,590
社区成员
发帖
与我相关
我的任务
分享
--nbdba大哥在坑你,这样
delete top (50)
tablename
where ...
[Quote=引用 7 楼 nintendo_hc 的回复:]delete from tb where 条件 and 时间 in(select top 100 时间 from tb where 条件 order by 时间)
;with f as
(
select id=row_number()over(order by 时间字段),* from tb
)
delete from f where id<=100
IF (SELECT COUNT(*) FROM table1)>=100000
BEGIN
SET ROWCOUNT 100
DELETE table1
SET ROWCOUNT 0
END
delete (top 50)
tablename
where ...