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

编程学习 2021-07-05 13:42www.dzhlxh.cn编程入门
这篇文章主要介绍了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快,而且释放日志所占资源,不记录由于删除行的影响所产生的日志。

Copyright © 2016-2025 www.dzhlxh.cn 金源码 版权所有 Power by

网站模板下载|网络推广|微博营销|seo优化|视频营销|网络营销|微信营销|网站建设|织梦模板|小程序模板