How to delete the top 1000 rows from a table using Sql Server 2008?

前端 未结 7 1041
小鲜肉
小鲜肉 2020-12-01 02:34

I have a table in SQL Server. I would like to delete the top 1000 rows from it. However, I tried this, but I instead of just deleting the top 1000 rows it deleted all the

7条回答
  •  猫巷女王i
    2020-12-01 03:00

    delete from [mytab]
    where [mytab].primarykeyid in
    (
    select top 1000 primarykeyid
    from [mytab]
    )
    

提交回复
热议问题