作者ruby0104 (:))
看板Database
标题Re: [SQL ] 请问删除语法中的truncate和delete 有ꐠ…
时间Fri Aug 31 02:00:58 2007
※ 引述《alexcwtzeng (狂泻不止)》之铭言:
: 所以在 begin tran ... end tran 的 block 里,所有的东西都可以 rollback。
: 但这是网路文章,我只是引述。SQL-Server 偶不会。
: 但是 Oracle Database 中,truncate table 与 delete table 是很大的不一样滴。
: 在 ANSI/ISO standard 中说明 DDL 是属於 autocommit 的指令。
: 而 truncate 是属於 DDL 的指令。
原来是SQL Server特有的啊 XD
印象中 我一直觉得不行 可能是因为上课学的也都是standard吧
直到後来有一次在SQL Server上测试 发现可以rollback 还以为是我记错了
原来是SQL Server 不标准啊
找了一下 .....网路上是这麽说的...in SQL Server
TRUNCATE is also a logged operation, but in a different way.
TRUNCATE logs the deallocation of the data pages in which the data exists.
The deallocation of data pages means that your data rows still actually exist
in the data pages, but the extents have been marked as empty for reuse.
This is what makes TRUNCATE a faster operation to perform over DELETE.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 71.132.213.174
※ 编辑: ruby0104 来自: 71.132.213.174 (08/31 02:09)
※ 编辑: ruby0104 来自: 71.132.213.174 (08/31 04:51)