TRUNCATE TABLE in SQL

TRUNCATE TABLE is a Data Definition Language operation in SQL that marks the extent of a table for deallocation. This operation removes all data from a table quickly, typically bypassing a number of integrity-enforcing mechanisms.

The syntax is the same in all the SQL products such as MySQL, PostgreSQL, SQL Server, etc.

Syntax:
TRUNCATE TABLE TableName

Example:
TRUNCATE TABLE tbEmployees;

The data from tbEmployees will be deleted in the preceding example, but the table definitions and integrity constraints associated with it will remain.

Please visit the index page to go through the SQL Server tutorial.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s