Loading ...

What are Difference between Delete and Truncate in SQL | CodeAsp.Net

Difference between Delete and Truncate in SQL

 /5
0 (0votes)

Truncate: Truncate is DDL (Data definition language) command. We can’t use where clause with truncate command. Once table is truncate we can’t rollback the data because it released the data from the memory. Truncate is faster than Delete because we can’t rollback the data in truncate and we can’t use the where clause. Truncate resets identity of the table.
Syntax: Truncate table TableName

Delete: Delete is DML (Data manipulation language) Command. In Delete we can use the where clause and rollback the deleted data. Delete check constraints, if a constraint exists then it shows error. It is slower than truncate
Syntax: Delete from TableName (this command deletes all record from the table)
Delete from TableName Where ColumnName =YourCondition (It delete those record where given condition is match)

Comments (no comments yet)

  • :*
  • :*
  • :
 *

Top Posts