t-sql清空表数据的两种方式示例(truncate and delete)
程序员文章站
2023-11-04 20:29:34
复制代码 代码如下:truncate table (transact-sql)
removes all rows from a table without logging...
复制代码 代码如下:
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快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。
下一篇: SQLSERVER分布式事务使用实例