Page 1 of 1

Error reading nullable date from sequential file

Posted: Mon Apr 14, 2008 11:42 pm
by opdas
Hi,
We have problem in reading CSV sequential file. The date column is nullable and is a empty string when null. The null field value is set to "", the SQL Type set for the column is Date with length 10. The date format is %yyyy-%mm-%dd.
At field "dt": A fixed length field cannot have a "null_field" of length 0 on import
regards
Om

Posted: Mon Apr 14, 2008 11:45 pm
by ray.wurlod
The representation of NULL must have precisely 10 characters if you have specified that the field width is 10.

Otherwise read the field as VarChar, and convert it to Date subsequently. VarChar can legitimately have a value whose length is zero. Date can not. Any specified in-band null (representation of null) must be a legitimate value for the data type.

Posted: Mon Apr 14, 2008 11:52 pm
by opdas
Well I guess thats the only way around.
Thanks for your time.

Regards
Om

Posted: Tue Apr 15, 2008 12:09 am
by John Smith
Or you could always have a default low value for any null dates
eg. 0001-01-01
provided your application/database allows that.This is similar to how we have high value dates e.g 9999-12-31

Posted: Tue Apr 15, 2008 12:48 am
by opdas
True, it would be better having a low value like you have suggested but we dont have control over the source feed :? .

Regards
Om