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

what are the new features introduced in sql server 2000? : Sql server database administration

550


How to use subqueries with the in operators in ms sql server?

569


Delete duplicate rows without using rowid.

1075


What is table constraint?

543


How to use subqueries in the from clause in ms sql server?

571






Explain the use of containers in ssis?

536


What is store procedure? How do they work? When do you use?

515


Mention the command used to rename the database.

536


How do I setup a sql server database?

552


Does an index slow down updates on indexed columns?

582


query processing

1740


What are the underflow and overflow behaviors on float literals?

580


Why people hate cursor?

733


What is database replication?

579


What is raid and what are different types of raid levels?

596