Differencr Between DELETE and TRUNCATE?

Answers were Sorted based on User's Feedback



Differencr Between DELETE and TRUNCATE?..

Answer / rajesh bhawsar

delete command, delete row by row and same time it makes an
entry in transaction log
while truncate remove the referance of respective
page/extent and doesn't make any entry in transaction log
truncate is faster then delete.
in case of truncate seed value (auto increment column) reset
to default unlike delete.

Is This Answer Correct ?    6 Yes 1 No

Differencr Between DELETE and TRUNCATE?..

Answer / manoj pandey

DELETE vs TRUNCATE
Check: http://sqlwithmanoj.wordpress.com/2009/02/22/difference-between-truncate-delete-and-drop-commands/

~Manoj

Is This Answer Correct ?    1 Yes 0 No

Differencr Between DELETE and TRUNCATE?..

Answer / wasimali

1) Delete command maintained the log files in each deleted row but truncate command do not maintained the log files for each deleted row but maintain the record for DE-allocation
of data-pages in the log files

2)Delete is a DML command and truncate is a DDL command.
3)Trigger is fired in case of delete command only but they are not fired when truncate command is used.

4)you can used where clause in case of delete command use to delete a particular row,
but you can not use where clause in case of truncate command use to delete a data from rows.

5) Truncate command reset the identity property to its initial values whereas delete command can not reset its identity property of its column.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

How many columns can exist together per table?

0 Answers   Cap Gemini,


What is the difference between the following two sql statements select count(*) from <tablename> select count(col_name) from <tablename>

5 Answers   247Customer,


What are defaults? Is there a column to which a default can't be bound?

2 Answers   TCS,


What is one of the first things you would do to increase performance of a query? For example, a boss tells you that ?a query that ran yesterday took 30 seconds, but today it takes 6 minutes?

2 Answers   Accenture, Merrill Lynch, Wipro,


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

0 Answers   Facebook,






What is the difference between resultset and resultsetmetadata?

0 Answers  


How can you control the amount of free space in your index pages?

0 Answers  


What is buffer cash in sql server?

0 Answers  


What are filegroups in sql server?

0 Answers  


Explain the concept of recursive stored procedure.

0 Answers  


How to change the system date and time from SQL Plus Terminal ?

0 Answers   MCN Solutions,


What are the restrictions that views have to follow?

0 Answers  


Categories