Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2010
    Posts
    9

    Unanswered: How to execute more than one sql queries from db2 prompt

    Hi,

    Could anyone plz tell me how to execute mutilpe SQL queries from db2 command prompt.

    For example:
    select count(*) from sysibm.sysdatatypes
    select name from sysibm.sysdatatypes

    I tried using semicolon but it failed.

    Thanks,
    Rons.

  2. #2
    Join Date
    Jan 2010
    Posts
    335
    Hi,

    you have to put the commands in a file and execute it using
    db2 -tf <File>
    or
    db2 -vtf <File>

  3. #3
    Join Date
    Feb 2010
    Posts
    9
    Thanks for the reply.

    Apart from using a file, is there any other way to execute these queries from the db2 prompt itself.

    Rons.

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    db2 select * from table ; db2 select * from table
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    Mar 2009
    Posts
    16
    Hi,

    For running multiple queries from db2 prompt, you can simply run the queries without a semi colon.
    eg.
    select count(*) from sysibm.sysdatatypes
    select name from sysibm.sysdatatypes

    there is no need for a semi colon.

    Regards
    Tini

Posting Permissions

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