What is difference between TRUNCATE and DELETE statement

Answer Posted / manub22

–> DELETE:

1. Removes Some or All rows from a table.
2. A WHERE clause can be used to remove some rows. If no WHERE condition is specified, all rows will be removed.
3. Causes all DELETE triggers on the table to fire.

–> TRUNCATE:

1. Removes All rows from a table.
2. Does not require a WHERE clause, so you can not filter rows while Truncating.
3. IDENTITY columns are re-seeded on this operation, if no seed was defined then the default value 1 is used.
4. No Triggers are fired on this operation because it does not operate on individual rows.

Check more differences b/w DELETE & TRUNCATE here: http://sqlwithmanoj.com/2009/02/22/difference-between-truncate-delete-and-drop-commands/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to delete an existing database user?

737


What is data compression?

735


Explain the difference between primary keys and foreign keys?

697


how you can deploy an ssrs report?

139


What is sql server replication? : sql server replication

692






What are the diifferences between the ms sql server vs mysql?

888


What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?

636


You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?

678


Is resultset an interface?

718


can you implement data mining in SSRS?

125


How to get a list of columns in a view using "sys.columns" in ms sql server?

723


what are acid properties? : Sql server database administration

668


How do I view a stored procedure in sql server query?

701


What is pessimistic concurrency?

709


Explain about local stored procedure?

702