Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    37

    Unanswered: 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

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •