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

What is the process of normalization?

0 Answers  


can an order by clause be used in a creation of a view?

0 Answers  


Is it possible to update the views? If yes, how, if not, why?

0 Answers  


What are all new concepts in SQL Server 2008? That is Exactly Difference between 2005 to 2008

2 Answers   IBM,


What is the command used to get the version of sql server?

1 Answers  






Hi All, I want to display all duplicate records in the table. My query has to fetch all the records which are duplicate(First Name or Last Name). Also I want the ability to also pull names where there might be a middle initial placed in the end of the first name field, (i.e., "Maria Z. " vs. "Maria") as well. Please guide me to find this. Table: ID FirstName LastName 1 Zach H Hoffman 2 Zach Hoffman 3 Troy Hoffman 4 Shawn Livermore 5 Prem S 6 Jony Hoffman H 7 Zach Modan I need the query to filter......... ID FirstName LastName 1 Zach H Hoffman 2 Zach Hoffman 3 Troy Hoffman 6 Jony Hoffman H 7 Zach Modan I hope this example will give you clear idea..... Thanks in Advance Prem

2 Answers  


What is shrink log file?

0 Answers  


What factors you will consider calculating the storage requirement for that view?

0 Answers  


What is the difference between update lock and exclusive lock?

0 Answers  


When is the use of update_statistics command?

0 Answers  


Which are ddl commands?

0 Answers  


List all the types of user-defined functions?

0 Answers  


Categories