Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Posts
    4

    Unanswered: how to execute sql script (ddl, dml) in db2?

    i have ddl and dml sql scripts... how do i execute it in db2 command line or control center or command center.
    the sql commands (dropt/ create table) contains semi-colons and "create table" commands is multi-line.

  2. #2
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    141
    In the db2 command line, type

    db2 list command options

    You'll get a list of parameters you can use.
    To read from a file, just use

    db2 -tvf <your_file_name>

    HTH
    Rodney Krick

  3. #3
    Join Date
    Mar 2003
    Posts
    4
    hi i got it but it wont execute the sql commands...
    ie.

    DROP SEQUENCE alert_id_seq restrict
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0900N The application state is in error. A database connection does not
    exist. SQLSTATE=08003

    why?

  4. #4
    Join Date
    Mar 2003
    Posts
    4
    btw, the table alert_id_seq doesnt exist yet.. is it an expected error message for non-existent tables?

  5. #5
    Join Date
    Mar 2003
    Posts
    4
    RKrick, thank you very much!! i got it running now w/o problem.

Posting Permissions

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