
代码如下:
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快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。
您可能感兴趣的文章:
详解MySQL中DROP,TRUNCATE 和DELETE的区别实现mysql从零开始sqlserver 日志恢复方法(搞定drop和truncate)MySQL删除数据Delete与Truncate语句使用比较SQL Server误区30日谈 第19天 Truncate表的操作不会被记录到日志sqlserver中drop、truncate和delete语句的用法mysql 删除操作(delete+TRUNCATE)MySQL中truncate误操作后的数据恢复案例详解SQL中drop、delete和truncate的异同实例理解SQL中truncate和delete的区别SQL Server中TRUNCATE事务回滚操作方法