t-sql清空表数据的两种方式示例(truncate and delete)

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

t-sql清空表数据的两种方式示例(truncate and delete)

  2020-12-16 我要评论
这篇文章主要介绍了t-sql使用truncate and delete清空表数据的两种方法,大家参考使用

复制代码 代码如下:

TRUNCATE TABLE (Transact-SQL)

Removes all rows from a table without logging the individual row deletions.

TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause;

however, TRUNCATE TABLE is faster and uses fewer system and transaction log resources.


两者的区别在于Truncate快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们