美文网首页
SQLSERVER 笔记

SQLSERVER 笔记

作者: cjjjjjj | 来源:发表于2023-04-18 09:24 被阅读0次

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