By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,778 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,778 IT Pros & Developers. It's quick & easy.

fyi load csv file from windows

P: n/a
sjs
Putting together other messages from this group I managed to load
variable length csv data using d2cmd/db2 tools under Windows. Another
catch was being able to load dates that may be null.

Here's the command I used:

load client from c:\temp\sample.csv of del modified by usedefaults
dateformat="YYYY-MM-DD" insert into sample_tbl nonrecoverable

By setting the dateformat, it quiets the error "The syntax of the string
representation of a datetime value is incorrect." By using usedefaults,
it makes the load set the field to whatever the default is in the table
if a value isn't provided.

Here's sample csv file data with a string, a date, and an integer. The
second line has an empty date which will be set to null if that's what
the field default value is for the table.

"apples","2004-08-26",100
"bananas",,200

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ian
sjs wrote:
Putting together other messages from this group I managed to load
variable length csv data using d2cmd/db2 tools under Windows. Another
catch was being able to load dates that may be null.

Here's the command I used:

load client from c:\temp\sample.csv of del modified by usedefaults
dateformat="YYYY-MM-DD" insert into sample_tbl nonrecoverable

By setting the dateformat, it quiets the error "The syntax of the string
representation of a datetime value is incorrect." By using usedefaults,
it makes the load set the field to whatever the default is in the table
if a value isn't provided.

Here's sample csv file data with a string, a date, and an integer. The
second line has an empty date which will be set to null if that's what
the field default value is for the table.

"apples","2004-08-26",100
"bananas",,200


The dates in your CSV file should not be enclosed by quotes. This
should be:

"apples",2004-08-26,100
"bananas",,200
As for the second row, the date field will have a NULL regardless of
whether there is a defined default value (unless the date column is
defined NOT NULL, in which case the row will be rejected).

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2

P: n/a

"sjs" <sj*****@hotmail.com> wrote in message
news:cg***********@spnode25.nerdc.ufl.edu...
Putting together other messages from this group I managed to load
variable length csv data using d2cmd/db2 tools under Windows. Another
catch was being able to load dates that may be null.

Here's the command I used:

load client from c:\temp\sample.csv of del modified by usedefaults
dateformat="YYYY-MM-DD" insert into sample_tbl nonrecoverable

By setting the dateformat, it quiets the error "The syntax of the string
representation of a datetime value is incorrect." By using usedefaults,
it makes the load set the field to whatever the default is in the table
if a value isn't provided.

Here's sample csv file data with a string, a date, and an integer. The
second line has an empty date which will be set to null if that's what
the field default value is for the table.

"apples","2004-08-26",100
"bananas",,200

I don't quite see what your question or problem is. Could you please clarify
what you want from the people on the newsgroup?

Rhino

Nov 12 '05 #3

P: n/a
Ummm.... It *SAYS* FYI. It's a helpful tip or suggestion. Last I
recall, those were acceptable items to post. :)

Mairhtin

"Rhino" <rh****@NOSPAM.sympatico.ca> wrote in
news:mG********************@news20.bellglobal.com:

"sjs" <sj*****@hotmail.com> wrote in message
news:cg***********@spnode25.nerdc.ufl.edu...
Putting together other messages from this group I managed to load
variable length csv data using d2cmd/db2 tools under Windows.
Another catch was being able to load dates that may be null.

Here's the command I used:

load client from c:\temp\sample.csv of del modified by usedefaults
dateformat="YYYY-MM-DD" insert into sample_tbl nonrecoverable

By setting the dateformat, it quiets the error "The syntax of the
string representation of a datetime value is incorrect." By using
usedefaults, it makes the load set the field to whatever the default
is in the table if a value isn't provided.

Here's sample csv file data with a string, a date, and an integer.
The second line has an empty date which will be set to null if that's
what the field default value is for the table.

"apples","2004-08-26",100
"bananas",,200

I don't quite see what your question or problem is. Could you please
clarify what you want from the people on the newsgroup?

Rhino


Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.