开发者

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

SQL CE does not support TRUNCATE command. To clear 开发者_StackOverflow中文版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'


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜