Truncate (SQL)

In SQL, the TRUNCATE TABLE statement is a Data Definition Language (DDL) 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.

The TRUNCATE TABLE mytable statement is logically (though not physically) equivalent to the DELETE FROM mytable statement (without a WHERE clause). The following characteristics distinguish TRUNCATE TABLE from DELETE:

References

  1. ↑ "Description of the effects of nonlogged and minimally logged operations on transaction log backup and the restore process in SQL Server". Microsoft. December 2005.

Notes


This article is issued from Wikipedia - version of the 8/19/2013. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.