Prepare for your Next Interview
This is a discussion on Why Truncate is DDL? within the SQL Server forums, part of the Databases category; The Delete command is a DML statement because it deletes data from table The Truncate command is also Delete the Records from tables. But how the Truncate command comes under ...
|
|||
|
The Delete command is a DML statement because it deletes data from table
The Truncate command is also Delete the Records from tables. But how the Truncate command comes under DDL Statement?? |
| Sponsored Links |
|
|||
|
Re: Why Truncate is DDL?
Where DELETE statement deletes rows from table matching specifications in WHERE clause .
TRUNCATE deallocates memory page(s) allocated for the specific table in memory and hence it is a DDL statement rather than DML. Ofcourse DELETE can be executed with out using WHERE calause to delete all the rows , however the page(s) are not deallocated . Additional info : DELETE statement is logged operation and hence can be rolled back where as TRUNCATE is not and hence can not be rolled back HTH Regards, |
| The Following User Says Thank You to SQLTweety For This Useful Post: | ||
|
|||
|
Re: Why Truncate is DDL?
Good answer from SQLTweety. Deserves applauds.
![]()
__________________
Lack of WILL POWER has caused more failure than lack of INTELLIGENCE or ABILITY. -sutnarcha- |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| difference between delete and truncate | bvani | MY SQL | 18 | 12-13-2007 06:03 AM |