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

admin 2014年4月27日19:33:02MSSQLSERVER评论1,332 次浏览阅读模式


复制代码 代码如下:

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快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。


相关文章
weinxin
我的微信
微信扫一扫
admin
  • 本文由 发表于 2014年4月27日19:33:02
  • 转载请务必保留本文链接:https://anyun.org/a/jishuguanzhu/database/mssqlserver/2014/0427/148.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: