1、删除最早的1000条数据,保留近两年的数据
delete from tableA where id in (
select top 1000 id from tableA with(nolock)
where create_date < DATEADD(year, -2, GETDATE())
order by create_date asc
)
2、
1、删除最早的1000条数据,保留近两年的数据
delete from tableA where id in (
select top 1000 id from tableA with(nolock)
where create_date < DATEADD(year, -2, GETDATE())
order by create_date asc
)
2、
本文标题:SQLSERVER 笔记
本文链接:https://www.haomeiwen.com/subject/pccoddtx.html
网友评论