Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008

    Unanswered: how to pass variables into .sql file

    Dear All,

    I'm trying to write a batch file executing some sql statements (drop database, create database ...) in DB2 and the database name is a parameter.

    1. I have 2 files: run.bat and script.sql
    db2cmd db2 -f script.sql

    drop database mydb
    create database mydb
    connect to mydb user myuser using mypwd

    How can I pass variable (mydb...) into script.sql from run.bat?

    2. I include the sql statements within run.bat like below
    db2cmd -c -w -i db2 drop database mydb db2 create database mydb ...

    But it seems not able to execute more than 1 sql statement. How can I run many sql statements?

    I'm using DB2 8.1

    Thanks for your reading

  2. #2
    Join Date
    Jan 2003
    Provided Answers: 1
    check this out:
    there is explanation how to have only one DB2 file on Windows.
    Hope this helps,

  3. #3
    Join Date
    Aug 2008
    Dear grofaty,

    Thanks so much for the link, it really helps me


Posting Permissions

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