What's the difference between DELETE TABLE and TRUNCATE
TABLE commands?

Answer Posted / skybeaver

"Delete TableName" is a logged transaction. Every row
affected by the delete will be written to the transaction
log. This is done for RECOVERY purposes, so that the
transaction may be rolled forward from a previous database
dump.

"Truncate TableName" is non-logged. It removes all rows
from the table and releases all allocated segments in the
database, all without logging anything. This is not
something a developer does, but rather is done by a DBA as
part of some sort of housekeeping.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the sql case statement used for? Explain with an example?

542


What are transactions in sql?

556


What is the difference between having clause and where clause in sql server?

575


How use inner join in sql server?

617


How to disable stored procedure sql server?

965






How to create an inline table-valued function?

540


What is resultset concur_updatable?

586


What is sql server used for?

558


How do I edit a procedure in sql server?

552


How raid can influence database performance?

579


Are semicolons required at the end of sql statements in sql server 2005?

570


What is optimization and its types?

539


what is a check constraint?

644


How do you create an execution plan?

498


What are the different types of sub-queries?

600