SQL Server Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 1252 Page Views: 

Whatis the difference between DELETE TABLE and TRUNCATE TABLE commands?



Posted By: Avi Date: 19 September 2009 04:17:27 AM
 Answer:

DELETE TABLE command is used to delete all the rows in a table. It is a logged operation, means the deletion of each row gets logged in the transaction log, which makes it slow.

TRUNCATE TABLE also deletes all the rows in a table, but it does not log the deletion of each row, instead it logs the deallocation of the data pages of the table, which makes it faster.

TRUNCATE TABLE can be rolled back while DELETE TABLE can not be rolled back.


Posted By: eTechPlanet


Date: 19 September 2009 04:17:27 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image tUO7H8
Related Questions
SQL Server : Write a query to select first 20 rows from a table having 100 rows?

Write a query to select first 20 rows from a table having 100 rows?

Select top 20 from table_name or Select * from table_name where count(*) <=20
Category: SQL Server Date: 10/1/2010 12:19:08 PM
SQL Server : What does the DROP Table command do?

What does the DROP Table command do?

DROP command will delete the data as well as destroy the structure of the table. Once applied the ta....
Category: SQL Server Date: 10/1/2010 12:18:08 PM
SQL Server : What is the purpose of INSTEAD OF Trigger in SQL SERVER?

What is the purpose of INSTEAD OF Trigger in SQL SERVER?

INTEAD OF Triggers are the procedures whih are executed in place of a specific DML command which is ....
Category: SQL Server Date: 10/1/2010 12:17:08 PM
SQL Server : Where in SQL server the User names and passwords stored?

Where in SQL server the User names and passwords stored?

In System catalog views.
Category: SQL Server Date: 10/1/2010 12:16:08 PM
SQL Server : What is the function of GO command in SQL SERVER?

What is the function of GO command in SQL SERVER?

To mark the end of the T-SQL batch statements GO command is used. Its should be kept in mind that GO....
Category: SQL Server Date: 10/1/2010 12:15:08 PM