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 / samba shiva reddy . m

DELETE TABLE is a logged operation, so the deletion of each
row gets logged in the transaction log, which makes it slow.
DELETE removes rows one at a time and records an entry in
the transaction log for each deleted row.
DELETE Can be used with or without a WHERE clause
DELETE Activates Triggers.
DELETE Can be Rolled back.
DELETE is DDL command
example :
begin transaction deleteoncondition
select * from emp

Delete * from emp where empid = 1

rollback deleteoncondition
select * from emp
sp_help samba --Table structure


TRUNCATE TABLE deletes all the rows in a table, but it
won't log the deletion of each row, instead it logs the
De-allocation of the data pages of the table, which makes it
faster.

Because TRUNCATE TABLE is not logged, it cannot activate a
trigger.
TRUNCATE can not be Rolled back using logs.
TRUNCATE is DDL Command.
TRUNCATE Resets identity of the table.
TRUNCATE wont delete the structure of the table.

DROP will delete the structure of the table also.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the partitioning method?

973


What happens to a statement batch if there is a compilation error?

898


What is report server project?

134


Explain about SQLOS?

946


What is indexing in sql server with example?

925


What is unique key constraint?

988


How to view existing indexes on an given table using sp_help?

1054


what is the difference between delete table and truncate table commands? : Sql server database administration

963


What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration

968


What is sql server programming?

978


How to check status of stored procedure in sql server?

912


How to select an exiting database using mssql_select_db()?

910


What is constraints and its types?

876


What is the optimal disk configuration for a database server and what raid configurations would you use if budget is not a constraint?

909


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

1116