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 are different types of table joins?

748


What is the order by used for?

792


Do you know what are the restrictions that views have to follow?

822


What are some examples of schemas?

705


What is b tree index?

678






What happens if we shrink log file in sql server?

691


What are the differences between DDL, DML and DCL in SQL?

941


Explain how to use linked server?

740


where the connection string store in the database

1725


Why I am getting this error when dropping a database in ms sql server?

774


What type of Index will get created after executing the above statement?

840


How do you create a data source?

649


What is local temp table?

699


What is data source document?

750


What is indexing a document?

725