Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: drop table if exists

    Hi,
    I want to drop a table only if exist in one SQL statement in DB2.
    Is it possible in DB2" if yes, can anyone help with the command.

    Thanks,
    Atun

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: drop table if exists

    Originally posted by atun_b
    Hi,
    I want to drop a table only if exist in one SQL statement in DB2.
    Is it possible in DB2" if yes, can anyone help with the command.

    Thanks,
    Atun
    The following script should work (it's not a single statement but pretty close:-)

    update command options using s off;
    drop table sysibm.sysdummy1;
    update command options using s on;

    This will tell the command processor to ignore the error in case the table does not exist.

  3. #3
    Join Date
    Mar 2004
    Posts
    2
    The command didn't work for me. I'm getting the error message.

  4. #4
    Join Date
    Jan 2003
    Posts
    1,605
    Hi,

    Are you trying to execute from Command Window? If so then use command without ";" character.

    Hope this helps,
    Grofaty

Posting Permissions

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