How to load data from flat file onto db2 table



IBM's flagship relational database management system

How to load data from flat file onto db2 table

Postby savitha_y » Thu May 28, 2009 2:39 pm

Hi,

I have a requirement where i need to load the data on db2 table from flat file using load utility.

the flat file contains 3 date fields which may contain null values

when i load the data from file it ended with an I/O error ...

Could any one please suggest, how to convert the flat file into table loadble format i.e. if date field have spaces it should load table field with null values else with the date value.

Thanks.
savitha_y
 
Posts: 18
Joined: Mon May 11, 2009 3:05 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to load data from flat file onto db2 table

Postby dick scherrer » Fri May 29, 2009 1:39 am

Hello,

Keep in mind that there is no such thing as a "null value". NULL is a condition not a value. When working with NULLs, you need to allow for the "null-indicator".

If would be rather trivial to write a bit of code to to read the flat file, move the values to host variables and INSERT the rows once the "formatting" had been done (i.e. setting the null-indicator for those rows with spaces in the date field).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: How to load data from flat file onto db2 table

Postby arcvns » Tue Jun 02, 2009 11:09 pm

Were you able to load your table?
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post