How to use Truncate Command in SQL Server?
Introduction:
In this article i will explain what is Truncate Command and how to use Truncate Command in SQL Server.
Description:
In previous articles i explained How to create a table in SQL Server, How to alter table column in SQL Server, How to add a column to table and How to delete a column from table in SQL Server, How to rename a column and How to rename a table in SQL Server, Update Command, and Delete Command. Now i will explain what is Truncate Command and how to use Truncate Command in SQL Server.
Here i'm using Employee table.
By Truncate command all the records will be deleted at a time and we can't get data, by using Delete command we can restore the data because the description of each record is maintained in the log file.
Syntax:
Truncate table <table-name>
Example:
Truncate table Employee
Execute the above statement. All records will be deleted at a time.
Note: If there is any identity column then Identity Seed will be reset to start value.
-
CreatedSep 22, 2013
-
UpdatedNov 03, 2020
-
Views1,958