Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    1,605

    Unanswered: How to also export column names?

    Hi,
    using db2 v9.5 on Linux. I need to export some data from DB2 table and in the target exported file I also need columns names. I tried to use 'export' command but by default it does not export column headers. Is there a way to export a columns names as well? Any other simple to do tip how to get columns names into exported file?
    Thanks

  2. #2
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Here is how I do it:

    • export to output_file_temp.del of del select ......
    • echo "colname1, colname2, colname3 ...." > output_file.csv
    • cat output_file_temp.del >> output_file.csv
    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
  •