SQL Server清除表中数据
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/429
删除表数据有两种方法:delete和truncate。
如果你只是想初始化表,那直接:
truncate table <表名>
完事。
truncate只用于表中清空数据。
它是清空,与delete有本质的区别。
delete与truncate最大的不同是:
- delete可以删除特定条件的一条或多条数据。
- delete删除的数据占位不会返还,意味着自增列Id为1的数据你删除了之后,再次插入数据不会从1开始。
This article was last edited at 2020-11-04 16:10:05