DB2 - Difference between DROP & TRUNCATE

 Posted by Bandi on 11/30/2013 | Category: Others Interview questions | Views: 2871 | Points: 40
Answer:

• Drop deletes the whole structure of table by means it removes the space for that object from database


• Truncate retains the table structure and removes the all records

Example:
--Truncate table Item
TRUNCATE TABLE Item IMMEDIATELY;
GO
SELECT * FROM Item;

We will get the table structure with no records

--DROP TABLE
DROP TABLE Item
GO
SELECT * FROM Item
GO
We will get the error due to inexistence of object called Item.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response