Results 1 to 5 of 5

Thread: Why Truncate is DDL?

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Answers
    28

    Question Why Truncate is DDL?

    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??


  2. #2
    Junior Member
    Join Date
    May 2007
    Answers
    16

    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,


  3. #3
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    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-

  4. #4
    Junior Member
    Join Date
    May 2007
    Answers
    16

    Re: Why Truncate is DDL?

    Glad I could help


    Keep inventing.

    Regards.


  5. #5
    Junior Member
    Join Date
    May 2008
    Answers
    4

    Re: Why Truncate is DDL?

    TRUNCATE TABLE handles table as an entity to clear all data from the specified table. It does not create log while deleting data from the table so it can not be rolled back. As it handles table it is DDL i.e Data Definition Language command.

    Where as DELETE command deletes specified rows with WHERE condition so it is DML.
    DELETE command creates log entry after deleting rows so can be rolled back.


  6.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact