数据库 
首页 > 数据库 > 浏览文章

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

(编辑:jimmy 日期: 2024/10/21 浏览:3 次 )

复制代码 代码如下:
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用t-sql命令批量删除数据库中指定表(游标循环删除)
下一篇:MSSQLSERVER跨服务器连接(远程登录)的示例代码
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 SiteMap