Re: [SQL ] 請問刪除語法中的truncate和delete 有ꐠ…

看板Database作者 (:))時間18年前 (2007/08/31 02:00), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串11/11 (看更多)
※ 引述《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)
文章代碼(AID): #16rmNRai (Database)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 11 之 11 篇):
文章代碼(AID): #16rmNRai (Database)