如何在SQL CE中删除表中的所有数据? [英] How to delete all data in a table in SQL CE?

查看:32
本文介绍了如何在SQL CE中删除表中的所有数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL CE 不支持 TRUNCATE 命令.要清除表,我必须使用 DELETE.有没有比以下命令更快/更好的方法来清除数据?

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'

推荐答案

你没有更好的方法来做到这一点,DELETE 是 SQL CE 用来删除行的 SQL 命令,反正 TRUNCATE TABLE 删除表中的每一行,因此如果您想删除所有 id 与 'ABC' 不同的行,您的 DELETE 查询也必须在 SQL Server 上执行.

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'.

如果您想删除 SQL CE 中的所有行,您必须使用

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.

这篇关于如何在SQL CE中删除表中的所有数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆