473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

CSV file with Headers

All -

I am trying to figure out how to get a comma delimited file from the
command line which includes the column headings as the first line. I
know how to create a del file using export, but it doesn't put the
headings. I also know I could redirect the output from a select, but a
select isn't comma delimited... Any ideas?

Dec 15 '05 #1
4 9184
DW Marker wrote:
All -

I am trying to figure out how to get a comma delimited file from the
command line which includes the column headings as the first line. I
know how to create a del file using export, but it doesn't put the
headings. I also know I could redirect the output from a select, but a
select isn't comma delimited... Any ideas?


Lots of options:

(1) write to the file and phrase the query in the export in such a way that
the first row produces the required headings
(2) use EXPORT and subsequently modify the file to prepend the header
(3) use a simple SELECT statement, redirect the output to a file, and along
the way ensure that the first row contains the header. You can do that by
redirecting two SELECT statements to the same file.
(4) Use a separate file for the header. That avoids the whole issue from
the beginning.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Dec 16 '05 #2
But is there a simple way to comma delimit a simple seldct statement..
The problem here is that I have to have a CSV file

Dec 16 '05 #3
The EXPORT command to DEL puts the delimiters in, as for the headers,
just add it manually to EXPORT's query with a UNION.

B.

Dec 16 '05 #4
DW Marker wrote:
But is there a simple way to comma delimit a simple seldct statement..
The problem here is that I have to have a CSV file


I guess there is a "no" missing somewhere in your sentence?

Adding the commas is quite easy:

SELECT col1, ',', col2, ',', col3
FROM ...

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Dec 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: edykstra | last post by:
Hello, If you point your browser to this page, http://prdownloads.sourceforge.net/vnc-tight/tightvnc-1.2.9_x86_viewer.zip?use_mirror=umn the server sends you the HTML page, and very soon...
2
by: Oleg Ogurok | last post by:
Hi all, On my web page, I have a <OBJECT DATA="mydatafile.ica" ...> which loads Citrix ICA web client. The problem is that I want to generate the mydatafile.ica on the fly (e.g. based on...
6
by: Omid | last post by:
Hi. I have problems when I try to redirect everything that is sent to cout to a file. I have one piece of code that works and one that does not work. The only difference is which headers I use....
4
by: Exits Funnel | last post by:
Hello, I'm slightly confused about when to use parens around #included files and when to use angle brackets. I understand (I think) that the difference is that the compiler will search in its...
9
by: comp.lang.php | last post by:
<?php if (headers_sent()) print_r('headers sent'); // do other stuff ?> I have a file, "classes.inc.php", a library of PHP version 4+ classes. This library file, the moment it is included,...
6
by: rony_16 | last post by:
Hi, I have problem with downloading a file using WebRequest and HttpWebResponse. Inorder to download this file i need to call to url that tells to prepare the file for download, and then i call...
1
by: krishan123456 | last post by:
i have tried to send email with attached doc file but when i receive the mail i find the attached file in encoded text instead of actuall attachment.the code that i used to send an email is given...
3
by: andersond | last post by:
I have a PHP file that usually sends an email. Instead, it now simply displays the code beginning with line 14 (where #eol= begins). Can anybody help me with this? <?php #Change only the...
2
by: Erik Witkop | last post by:
So I have been trying to get this to work all day. I can't get a local file on my web server to attach to an email. Right now I have it printing out in the body of the email. Please help me with...
8
blazedaces
by: blazedaces | last post by:
So I have a program below which writes an excel file with multiple sheets based on inputs of sheet names, data, cell types, etc. It uses Apache POI, which is currently the only thing I found...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.