SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


TRUNCATE


TRUNCATE

Author
Message
vk-kirov
vk-kirov
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3702 Visits: 4408
Peter Trast (4/7/2010)
vk-kirov (4/7/2010)
Maybe because TRUNCATE manipulates metadata, not data? (It's my suggestion only)

DOES truncate delete metadata??? (I am thinking no).

You are right. TRUNCATE does not delete metadata, it manipulates metadata. But... what is the relation between your (rhetorical) question and my suggestion? :-)

Let's see what exactly TRUNCATE does (http://msdn.microsoft.com/en-us/library/ms177570.aspx):
TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log.
TRUNCATE TABLE always locks the table and page but not each row.

Page deallocation is surely a metadata manipulation. Data remain intact in their comfortable pages... until the time comes. Whistling

Peter Trast (4/7/2010)
I guess I was suggesting that the person who authored that webpage didn't know what he was talking about :-)

Perhaps the definitions of DML/DDL on that page are slightly inaccurate.
But there's a dramatical difference between DML and DDL statements in Oracle. A DDL statement is committed implicitly and immediately, and cannot be rolled back. This is why it's very important to know the classification of the SQL commands.
Happily, we are using SQL Server and can roll back any DDL command; so I consider the question "is TRUNCATE a DDL statement or not?" as a theoretical question. Happily, Paul gave the straightforward answer to this question: it's a DML statement because Microsoft documentation says it. Other arguments may be (and have been) debated at least on two forum pages. Even using the de-duck-tion methods :-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search