View previous topic :: View next topic
|
Author |
Message |
anant_deshmukh21
New User
Joined: 19 Jun 2007 Posts: 2 Location: pune
|
|
|
|
[size=18]any one plz tell me the difference between TRUNCATE TABLE and DROP TABLE |
|
Back to top |
|
|
a027412
New User
Joined: 05 Jul 2007 Posts: 40 Location: Minneapolis, MN
|
|
|
|
to my knowledge, after issuing TRUNCATE command, all the record are deleted and just one record is put in the log. but once the DROP command is issued many records are written to the log. And more over the TRUNCATE command will put the schema in CHK PENDING state and DROP command will not.
Please correct me if am wrong |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post in the correct forum - this has been moved to DB2, if there is some reason to return it to cobol, please advise.
Also, please use the standard size not
fortunately, it wasn't specifiec correctly and did not appear as a shout |
|
Back to top |
|
|
0d311
Guest
|
|
|
|
Hi,
As I know, when you do a TRUNCATE TABLE, you only clear up the data and leave the table as is while when you do a DROP TABLE, you not only get rid of the data, but also get rid of the table in the database.
In any case, your boss wouldn't like you doing any of those in production. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
We do the TRUNCATE in production. It is more efficient than a DELETE FROM table_name. It logs one entry in the transaction log, instead of an entry for each delete.
We have tables that get emptied and reloaded from file provided to us by contractors often. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Yup, truncate does the housecleaning cheaply and still preserves the structure.
Hopefully, not just everyone has been granted permission to truncate production tables. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
We don't even have permission to truncate in Unit. We have to run it through a scheduled job if we are doing that. |
|
Back to top |
|
|
salehi
New User
Joined: 30 Sep 2006 Posts: 14 Location: Iran
|
|
|
|
TRUNCATE quickly removes all rows from a table. It has the same effect as an unqualified DELETE but since it does not actually scan the table it is faster. This is most useful on large tables |
|
Back to top |
|
|
|