Discussion:
Export data with column headers
(too old to reply)
a***@fiserv.com
2007-10-26 17:52:25 UTC
Permalink
Hi,

Is there any way where I can export the data along with column headers?

I am making use of DB2 export command with TAB as column header.

Thanks & Regards,

Ajay M
Blair Kenneth Adamache
2007-10-28 21:56:59 UTC
Permalink
Can you select from the table and pipe it to a file to get the column
headers?

C:\tmp>db2 -z out.txt select * from adamache.org:

C:\tmp>db2 -z out.txt select * from adamache.org

DEPTNUMB DEPTNAME MANAGER DIVISION LOCATION
-------- -------------- ------- ---------- -------------
10 Head Office 160 Corporate New York
15 New England 50 Eastern Boston
20 Mid Atlantic 10 Eastern Washington
38 South Atlantic 30 Eastern Atlanta
42 Great Lakes 100 Midwest Chicago
51 Plains 140 Midwest Dallas
66 Pacific 270 Western San Francisco
84 Mountain 290 Western Denver

8 record(s) selected.


C:\tmp>type out.txt

DEPTNUMB DEPTNAME MANAGER DIVISION LOCATION
-------- -------------- ------- ---------- -------------
10 Head Office 160 Corporate New York
15 New England 50 Eastern Boston
20 Mid Atlantic 10 Eastern Washington
38 South Atlantic 30 Eastern Atlanta
42 Great Lakes 100 Midwest Chicago
51 Plains 140 Midwest Dallas
66 Pacific 270 Western San Francisco
84 Mountain 290 Western Denver

8 record(s) selected.
Post by a***@fiserv.com
Hi,
Is there any way where I can export the data along with column headers?
I am making use of DB2 export command with TAB as column header.
Thanks & Regards,
Ajay M
Continue reading on narkive:
Loading...