Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is difference between TRUNCATE and DELETE statement

Answer Posted / shireen

TRUNCATE TABLE is functionally identical to DELETE
statement with no WHERE clause: both remove all rows in the
table. But TRUNCATE TABLE is faster and uses fewer system
and transaction log resources than DELETE.

The DELETE statement removes rows one at a time and records
an entry in the transaction log for each deleted row.
TRUNCATE TABLE removes the data by deallocating the data
pages used to store the table's data, and only the page
deallocations are recorded in the transaction log.

TRUNCATE TABLE removes all rows from a table, but the table
structure and its columns, constraints, indexes and so on
remain. The counter used by an identity for new rows is
reset to the seed for the column. If you want to retain the
identity counter, use DELETE instead. If you want to remove
table definition and its data, use the DROP TABLE statement.

You cannot use TRUNCATE TABLE on a table referenced by a
FOREIGN KEY constraint; instead, use DELETE statement
without a WHERE clause. Because TRUNCATE TABLE is not
logged, it cannot activate a trigger.

TRUNCATE TABLE may not be used on tables participating in
an indexed view.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to download and install the scaled-down database adventureworkslt?

951


how to do partition in sqlserver

2406


Does transparent data encryption provide encryption when transmitting data across the network?

980


can a database be shrunk with users active? : Sql server administration

950


Write a SQL query to delete a table?

1077


What is resultset concur_updatable?

967


What can be used instead of trigger?

1096


Explain the difference between function and stored procedure?

897


What is sharding?

114


what changed between the previous version of sql server and the current version? : Sql server database administration

955


What are the acid properties?

937


How to use user defined functions in expressions?

1005


when would you go for denormalization? : Sql server database administration

809


How to get the number of affected rows?

947


How to get the definition of a view out of the sql server?

938