Sunday , 25 June 2017
Home » SQL » Delete Truncate and Drop

Delete Truncate and Drop

Delete Truncate and Drop

Delete Truncate and DropIn this article I am going to explain the differences between delete, truncate and drop commands in sql server. Let me start by saying that these commands are similar but not the same. Every command does its unique work against the server. I can say that when using any of these three commands you should think very careful what you’re doing. You may not be able to go back once you perform any of these commands.


Delete command is used to delete records from the database table. You are controlling the delete. If you want you can delete specific record using where clause or you can delete all the records. Delete is DML. You can use trigger before or after delete command. With delete command you do not reset identity field. You can also rollback if you use delete command in a transaction. Syntax for delete is:


Truncate command is DDL. You can not use triggers with truncate command. Truncate command resets indexes, constraints, identity and you can not rollback from truncate command. Truncate is faster then delete because it does not check for certain rows. Syntax for truncate is:


Unlike delete and truncate, drop command is used to delete database. So when you drop a database that means you delete every tables on that database. Along with tables you delete stored procedures, functions and everything that is on that database. Syntax for dropping the database is:



Check Also

Stored Procedure vs Functions

Stored Procedure vs Functions In this article I am going to show you the differences …

One comment

  1. We are a group of volunteers and starting a new scheme in our community.

    Your site offered us with valuable information to work on.
    You have done an impressive job and our whole community will be
    thankful to you.

Leave a Reply

Your email address will not be published. Required fields are marked *