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
12USE [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