How to delete all data in a table in SQL CE?

ぃ、小莉子 提交于 2020-01-01 08:05:10

问题


SQL CE does not support TRUNCATE command. To clear a table I have to use DELETE. Is there a quicker/better way to clear the data then the following command?

DELETE FROM FooTable WHERE id !='ABC'

回答1:


You don't have any better way to do that, DELETE is the SQL Command for SQL CE to DELETE ROWS, anyway TRUNCATE TABLE deletes every row in a table, so your DELETE query must be executed also at SQL Server if you want to DELETE all the rows with id different from 'ABC'.

In the case you want to DELETE all the rows in SQL CE you must use

DELETE FROM FooTable

See you, I hope this post was useful to you.




回答2:


No, other than DROP TABLE, CREATE TABLE and INSERT the surviving data (if there are any)



来源:https://stackoverflow.com/questions/5673013/how-to-delete-all-data-in-a-table-in-sql-ce

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!