T-SQL Tutorials - TSQLTutorials.com | ||||||||||||||||||||||||||||||||||||||
TRUNCATE TABLE Statement | ||||||||||||||||||||||||||||||||||||||
|
|
Introduction
The TRUNCATE statement is used for removing all records from a table. The TRUNCATE statement is not a logged transaction. The TRUNCATE Statement has a simple syntax:
Example
In this example we will assume that the 'Employees' table contains the follow columns: 'Name', 'Position', 'Office' and 'Salary'.
SELECT *
We'll use the TRUNCATE statement to remove all the records from the table. TRUNCATE TABLE Employees Now we'll try to query the table again. We will find out that there are no longer any rows in the table. SELECT * FROM Employees
|
|
||||||||||||||||||||||||||||||||||||