Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Unanswered: Outputting SQL statement results to file

    Hi all,
    I would like to know please how you can capture results of an SQL statement within DB2 into a flat file.

    eg. select * from table >> file1

    I can then look at the results of the SQL statement in "file1" as an example.

    Thanks,
    Adrian

  2. #2
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    command line :

    db2 "select * from table " > file1.txt
    Rahul Singh
    Certified DB2 9 DBA / Application Developer

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Use the DB2 Command Window (Windows) or normal shell, not the DB2 shell. If using Windows, see your start menu for the DB2 Command Window. If using Linux/UNIX, just use normal shell (korn/bash, etc):

    db2 "select * from table" > file1
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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