SQL Server TRUNCATE TABLE | SJB -->

This website uses cookies to ensure you get the best experience. More info...

SQL Server TRUNCATE TABLE

We can use the TRUNCATE TABLE statement to remove all the records or specified partition of a table. This statement in SQL Server is similar to the DELETE statement without WHERE Clause.

TRUNCATE TABLE [YourDBName].[YourTableName]
OR
1
2
USE [YourDBName]
TRUNCATE TABLE [YourTableName]
The DELETE statement uses row lock, each row in the table is locked for removal. On the other hand, the TRUNCATE TABLE locks the table and pages instead of locking each row.

No comments:

Post a Comment