Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2003
    Posts
    6

    Unanswered: Running a Sql file

    i want to run a sql file (which has set of sql statements of insert) in db2 using command line processor in Windows Environment. If anybody knows, pls let me know.

    Thanks,
    Nagammai.

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

    Re: Running a Sql file

    If yours is ';' delimited then :

    db2 -tvf <filename>

    If the delimiter is something else, say @, then

    db2 -td@ -vf <filename>

    Have a look at the command reference chapter, DB2 command line processor ...

    Cheers

    Sathyaram

    Originally posted by Nagammai
    i want to run a sql file (which has set of sql statements of insert) in db2 using command line processor in Windows Environment. If anybody knows, pls let me know.

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

  3. #3
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    200
    Hi,

    create a .sql file.

    use db2 -tf sample.sql

    -tf is used since u use the ';'

    or u can just call the script file name from db2

    try it out

    mickykt

  4. #4
    Join Date
    Jul 2003
    Posts
    6

    Re: Running a Sql file

    Yes, I tried giving the same before ie

    db2 -tvf <file name> in the command prompt db2 == >

    but its giving a error saying
    SQL0104N An unexpected token "db2" was found following "BEGIN-OF-STATEMENT".
    Expected tokens may include: "SELECT". SQLSTATE=42601

    Please see the attcahed document.

    Thanks,
    Nagammai.


    Originally posted by sathyaram_s
    If yours is ';' delimited then :

    db2 -tvf <filename>

    If the delimiter is something else, say @, then

    db2 -td@ -vf <filename>

    Have a look at the command reference chapter, DB2 command line processor ...

    Cheers

    Sathyaram
    Attached Files Attached Files

  5. #5
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    200
    take command line Promt
    db2 >quite
    there u type the following command

    ...mickykt

  6. #6
    Join Date
    Mar 2003
    Location
    Singapore
    Posts
    200
    sorry i meant quit from db2 prompt or u can use the command prompt of db2

    mickykt

  7. #7
    Join Date
    Jul 2003
    Posts
    6
    Thanks a lot, It got worked this way!

    Originally posted by mickykt
    sorry i meant quit from db2 prompt or u can use the command prompt of db2

    mickykt

Posting Permissions

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