TRUNCATE TABLE

Remove all rows from a table. Truncate does not log row deletions in the transaction log.

Syntax

      TRUNCATE TABLE  [schema.] table [;]

      TRUNCATE TABLE  [database.[schema].] table [;]
   

TRUNCATE TABLE will remove all rows from a table, but retains the table structure (columns, constraints, indexes etc.)

Example

TRUNCATE TABLE MySchema.MyTable;
GO

"At a good table we may go to school" - Thomas Fuller

Related commands:

DELETE - Remove rows one at a time and record an entry in the transaction log for each.
DROP TABLE - Remove the table definition in addition to its data

Equivalent Oracle command: TRUNCATE TABLE


© Copyright SS64.com 1999-2014
Some rights reserved