If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to also export column names?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-29-12, 02:01
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
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
Reply With Quote
  #2 (permalink)  
Old 01-29-12, 10:29
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Reply With Quote
  #3 (permalink)  
Old 01-29-12, 15:07
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On