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

前端之家收集整理的这篇文章主要介绍了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快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。

原文链接:https://www.f2er.com/mssql/63339.html

猜你在找的MsSQL相关文章