龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 数据库类 > Sql Server开发 >

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

时间:2014-05-15 15:01来源:网络整理 作者:网络 点击:
分享到:
这篇文章主要介绍了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快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。

精彩图集

赞助商链接