根据行号删除数据。所有表只保留10条数据。批量的删除。

解决方案 »

  1.   


    把 要剩下的10ID号
    delete from tablaNmae1 where id not in (要剩下的10ID号);
    delete from tablaNmae2 where id not in (要剩下的10ID号);
    delete from tablaNmae3 where id not in (要剩下的10ID号);
      

  2.   

    我查到了,谢谢各位参与WITH [Tab ORDERED BY ID] AS
    (SELECT ROW_NUMBER() OVER (ORDER BY ID ASC) AS ROWID, * FROM Tab)
    DELETE FROM [Tab ORDERED BY ID] WHERE ROWID =300
      

  3.   

    ...........
    delete from tabla where id not in (....);