If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > truncate via sql statment

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-04, 05:05
bab bab is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
truncate via sql statment

hi all,

i can use the import-command (IMPORT FROM "/dev/null" OF DEL REPLACE INTO xyz to delete all rows rather than "delete from xyz" under db2 (oracle uses truncate table xyz) ..

how can i use the "import-command" in a java-application to delete rows of a big table? or is there any other methods like truncate under oracle to use ist within an application under db2?

thanks all
Reply With Quote
  #2 (permalink)  
Old 09-03-04, 05:20
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
ALTER TABLE <tablename> activate NOT LOGGED INITIALLY WITH EMPTY TABLE

This should work on any table in V8 ... If V7, the table should have been created with Not logged intially option ..

If you are using autocommit off, make sure you commit after the above statement ... If you do not do it and your transaction fails, the table will be marked invalid and you will have to drop and recreate the table ...

If you have a table dependent of the this table, you cannot issue the above statement ... Then you may be able to use the following statements (make sure to issue then in the same unit of work)
alter table table1 activate not logged initially
delete from table1

HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 09-03-04, 06:19
bab bab is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
Quote:
Originally Posted by sathyaram_s
ALTER TABLE <tablename> activate NOT LOGGED INITIALLY WITH EMPTY TABLE

This should work on any table in V8 ... If V7, the table should have been created with Not logged intially option ..

If you are using autocommit off, make sure you commit after the above statement ... If you do not do it and your transaction fails, the table will be marked invalid and you will have to drop and recreate the table ...

If you have a table dependent of the this table, you cannot issue the above statement ... Then you may be able to use the following statements (make sure to issue then in the same unit of work)
alter table table1 activate not logged initially
delete from table1

HTH

Sathyaram
thanks a lot, you are great
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On