What is the Difference in DROP, DELETE and TRUNCATE command in SQL Server ?

when should we used Drop, Delete, and Truncate command in SQL server?

Last updated:8/3/2018 2:47:09 AM

1 Answers

Anonymous User
Anonymous User

Truncate:- This is the part of DDL command in SQL. when we use the truncate command on a table then deleted all records and rows from that table and release space that's used by the table in database memory.

Delete:- when we use the DeleteCommand in SQL server on a table without any condition then all rows and data will be deleted from that table but the structure will not be removed. It means memory space will be not free. It means in delete case the memory space will be not free.

DROP:- When we used DROP command on a table, then the rows and records in the table are deleted and the table structure is also removed from the database. Once a table is dropped we cannot get it back, so be careful while using the DROP command. When a table is dropped all the references to the table will not be valid.