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 is the difference between clustered and a non-clustered index?

591


Explain user defined functions?

611


What is a select query statement in ms sql server?

578


Does sql server use java?

517


Where to find ntwdblib.dll version 2000.80.194.0?

551






What do you mean by a dependent functionality in a build?

656


How to create new table with "create table" statements?

558


What is the difference between a function and a stored procedure?

562


i have made a project i vb.net n created a .exe of it after installing it in to any pc, the database (sql express) is not geting accesed i.e the aplication cuts the link of the database, so plz help in this matter.

1374


What is the purpose of the tempdb database?

571


What is the report builder?

106


What are the difference between data mart and data warehouse? : sql server analysis services, ssas

500


What do you understand by mirroring and mention the advantages of the mirroring?

577


Explain can you implement data mining in ssrs?

106


Explain query editor regions

612