473,606 Members | 2,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

export and dateformat to produce CSV file

Hello,

If I export a file containing date field,
export to "/james/j.txt" of DEL
select a1,adate from a

The date is represented in YYYY/MM/DD format as expected.

Output I need is to be in "yyyymmdd" without delimiter. MODIFIED BY
DATESISO option has a delimiter.

I am getting the same ouput despite using the following:
export to "/james/j.txt" of DEL
select a1,replace(char (adate),'/','') from a
From using just the select statement and running from command line with

-z option, I am able to redirect output to a file, but it is not in CSV
format. This is a big SQL and I do not want to manually insert commas
to separate in select statement.

Can someone throw light on this. Specifically for the export with
modified by, and for using select in command line and get a CSV format.
Thanks a bunch.

Nov 12 '05 #1
2 11477

<hi****@gmail.c om> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
Hello,

If I export a file containing date field,
export to "/james/j.txt" of DEL
select a1,adate from a

The date is represented in YYYY/MM/DD format as expected.

Output I need is to be in "yyyymmdd" without delimiter. MODIFIED BY
DATESISO option has a delimiter.

I am getting the same ouput despite using the following:
export to "/james/j.txt" of DEL
select a1,replace(char (adate),'/','') from a
From using just the select statement and running from command line with

-z option, I am able to redirect output to a file, but it is not in CSV
format. This is a big SQL and I do not want to manually insert commas
to separate in select statement.

Can someone throw light on this. Specifically for the export with
modified by, and for using select in command line and get a CSV format.
Thanks a bunch.


The DB2 documentation sheds some light on this - specifically footnote 3:

http://publib.boulder.ibm.com/infoce...e/r0011046.htm

If you're using DB2 v8 FP2 or later, the following command will do what you
want:

EXPORT TO "/james/j.txt" OF DEL
MODIFIED BY TIMESTAMPFORMAT ="YYYYMMDD"
SELECT a1, adate FROM a

If you have Perl, you can easily remove the delimiters using the following
command:

perl -pi -e 's#/##g' /james/j.txt

--
Matt Emmerton
Nov 12 '05 #2
EXPORT TO "/james/j.txt" OF DEL
MODIFIED BY nochardel
SELECT a1, adate FROM a

The above works fine:
I/p data:
c1 bdate
------------------
1 2005-01-28

2 2005-01-28

21 2005-01-28

22 2005-01-28

41 2005-01-28

42 2005-01-28
Output in csv format picked up in spreadsheet:

1 20050128
2 20050128
21 20050128
22 20050128
41 20050128
42 20050128
Matt Emmerton wrote:
<hi****@gmail.c om> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
Hello,

If I export a file containing date field,
export to "/james/j.txt" of DEL
select a1,adate from a

The date is represented in YYYY/MM/DD format as expected.

Output I need is to be in "yyyymmdd" without delimiter. MODIFIED BY
DATESISO option has a delimiter.

I am getting the same ouput despite using the following:
export to "/james/j.txt" of DEL
select a1,replace(char (adate),'/','') from a
From using just the select statement and running from command line
with -z option, I am able to redirect output to a file, but it is not in CSV format. This is a big SQL and I do not want to manually insert commas to separate in select statement.

Can someone throw light on this. Specifically for the export with
modified by, and for using select in command line and get a CSV format. Thanks a bunch.
The DB2 documentation sheds some light on this - specifically

footnote 3:
http://publib.boulder.ibm.com/infoce...e/r0011046.htm
If you're using DB2 v8 FP2 or later, the following command will do what you want:

EXPORT TO "/james/j.txt" OF DEL
MODIFIED BY TIMESTAMPFORMAT ="YYYYMMDD"
SELECT a1, adate FROM a

If you have Perl, you can easily remove the delimiters using the following command:

perl -pi -e 's#/##g' /james/j.txt

--
Matt Emmerton


Nov 12 '05 #3

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

Similar topics

205
10543
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
5
11020
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after setting stDataSource and stFileName to the desired values. Most of the time it works, but occasionally, typically as code changes are being made to the module, the following message appears:
16
11835
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation. I can do this individually for each graph but this does not help me as I need both on the same JPEG. I thought I would try an export the form that contains both but I am having trouble. (My VBA is self taught and a little knowledge is...
3
4893
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office XP Prof. 2002 version). With formatted output I mean the *exactly* output I produce from executing my report (information is gathered from an ODBC database).
4
4227
by: newtophp2000 | last post by:
Hello, I receive a file containing some character fields along with a date. The date values in the file are formatted as "dd/mm/yy", that is 2-digit day, 2-digit month, and 2-digit year. The separator could be slash or a dash ("-"). The file is in a proprietary format, and bcp is not an option. So, I decided to load the file using a prepared statement. I open a cursor with an INSERT statement, read from the file, parse out values,
5
30173
by: no_spam_for_gman | last post by:
I have been using the export command for quite some times to export comma delimited file. I have always been looking at how to generate the first row with the column header but never found a clean way to do it. I have searched this newsgroup and the only suggestion found was to cast all column to strings and do a union, or to add the first row afterwards and I saw one suggestion where it was to create a unix script. Does anybody knows...
1
2848
by: davidwelli | last post by:
Hello, I have a Access 200 format database that contains contact details and a picture for each record. The contact details are held in one table and the images are held in another as OLE Objects. This database is used to produce passes. I want to export one record from the dartabase including the picture into a format that can be easily tansferred by email. I've created a query based on the two tables that will retreive all the...
1
3211
zigman68
by: zigman68 | last post by:
I have a problem with the DateFormat() Function that is driving me nuts! I am downloading a csv and then parsing through it, then inserting into a SQL 2005 DB. Here is the problem. ... A number of fields that are passed are strings representing dates. E.G. 20080324 ( which I read as 2008/03/24) Sometimes they are there sometimes they are not. When I perform a DateFormat on them to set them in my VAR, this is what I am getting back for the...
2
4030
by: Marisol2 | last post by:
I have some queries in Access 2003 db that I have setup to display as pivots. I can go into design pivot table view and click on and then click on Export to Office MicroSoft Excel. The problem is I have about 6 queries that produce 48 reports (based on parameters). I don't want to manually save each pivot query results. The first macro I created to export the queries I used TransferSpreadsheet but the export results are regular xls...
0
8031
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7962
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8456
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8443
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8107
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6792
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5971
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2452
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.