1 Answers
Differences between DELETE, TRUNCATE, and DROP commands in T-SQL
DELETE:
- DELETE command is used to remove specific rows from a table based on a condition.
- It is a DML (Data Manipulation Language) command.
- DELETE operations can be rolled back using a transaction.
TRUNCATE:
- TRUNCATE command is used to remove all the rows from a table, but the table structure remains intact.
- It is a DDL (Data Definition Language) command.
- TRUNCATE operations cannot be rolled back.
- TRUNCATE is faster than DELETE as it does not log individual row deletions.
DROP:
- DROP command is used to delete an entire table including its structure from the database.
- It is a DDL (Data Definition Language) command.
- DROP operations cannot be rolled back.
Please login or Register to submit your answer