Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Database (http://www.go4expert.com/forums/database-forum/)
-   -   How do you differentiate between truncate and delete? (http://www.go4expert.com/forums/differentiate-truncate-delete-t10646/)

aspguy 16May2008 17:47

How do you differentiate between truncate and delete?
 
How do you differentiate between truncate and delete?

shabbir 16May2008 22:02

Re: How do you differentiate between truncate and delete?
 
DELETE is an operation on a per row basis.

TRUNCATE deallocates data pages which makes TRUNCATE a faster operation to perform over DELETE.

You cannot TRUNCATE a table that has any foreign key constraints. You will have to remove the contraints, TRUNCATE the table, and reapply the contraints.

Also truncate is a DDL command operation.

Gloria-123 23Jun2008 08:32

Re: How do you differentiate between truncate and delete?
 
I even don't get the choice to use the truncate. So when do you use this operation?

skp819 11Dec2008 17:40

Re: How do you differentiate between truncate and delete?
 
The Main Difference Between DELETE & TRUNCATE Are :-
[1] DELETE - is a DML Command & TRUNCATE - is a DDL Command
[2] After DELETE - can rollback the Records & After TRUNATE - cannot rollback the records
[3] In DELETE Command you can give the conditions in WHERE Clause & In TRUNCATE you cannot give conditions
[4] After using DELETE Command The memory will be occupied till the user does not give ROLLBACK or COMMIT & After using TRUNCATE Command The memory realeased immediately


All times are GMT +5.5. The time now is 07:47.