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.)

Examples

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 © 1999-2024 SS64.com
Some rights reserved