Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Location
    New York
    Posts
    14

    Angry Unanswered: Execute filename.sql with variables

    Hi all,

    Dose anybody know how to execute filename.sql with variables ?

    We usually execute filename.sql by command, db2 -vtf filename.sql; however, i want to bring variables into filename.sql for the name of database when connecting database, for example,

    connect to %dbname

    Well, I cound not find any info in command reference.

    Please also give me a brife example.

    Thank you so much !!

    Sophie

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Execute filename.sql with variables

    This is not possible in a db2 script AFAIK ...

    But you can do shell scripting or windows batch files to accompolish this ..

    Eg:

    #!/bin/ksh
    connect to $1

    HTH

    Sathyaram
    Originally posted by Sophie Hsiao
    Hi all,

    Dose anybody know how to execute filename.sql with variables ?

    We usually execute filename.sql by command, db2 -vtf filename.sql; however, i want to bring variables into filename.sql for the name of database when connecting database, for example,

    connect to %dbname

    Well, I cound not find any info in command reference.

    Please also give me a brife example.

    Thank you so much !!

    Sophie
    Visit the new-look IDUG Website , register to gain access to the excellent content.

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

    Re: Execute filename.sql with variables

    Originally posted by sathyaram_s

    Eg:

    #!/bin/ksh
    connect to $1
    You probably meant:

    #!/bin/ksh
    db2 connect to $1

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Execute filename.sql with variables

    Thanks Nick, for point out ...

    Cheers
    Sathyaram

    Originally posted by n_i
    You probably meant:

    #!/bin/ksh
    db2 connect to $1
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Nov 2003
    Location
    New York
    Posts
    14

    Re: Execute filename.sql with variables

    Thanks both anyway !!

    Sophie

    Originally posted by sathyaram_s
    Thanks Nick, for point out ...

    Cheers
    Sathyaram

Posting Permissions

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