when should we used Drop, Delete, and Truncate command in SQL server?
What is the Difference in DROP, DELETE and TRUNCATE command in SQL Server ?
126303-Aug-2018
Updated on 03-Aug-2018
Home / DeveloperSection / Forums / 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?
Anonymous User
03-Aug-2018Truncate:- 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.