Search code examples
sql-serverddltruncate

Truncate a DDL or DML command


I always knew that TRUNCATE is a DDL command but Microsoft documents are confusing me.

This link says that TRUNCATE is a DDL command and this says that TRUNCATE is a DML command

Also, does clarification of DDL and DML are different in different database? Ex. Oracle, MySql etc.


Solution

  • Wikipedia says TRUNCATE is DML:

    In SQL, the TRUNCATE TABLE statement is a Data Manipulation Language (DML) operation that marks the extents of a table for deallocation (empty for reuse). The result of this operation quickly removes all data from a table, typically bypassing a number of integrity enforcing mechanisms. It was officially introduced in the SQL:2008 standard.

    https://en.wikipedia.org/wiki/Truncate_(SQL)