Strings in column of type DATE |
Remco Schoen |
2009-11-04 06:26:33 |
If I have a string in a column of type DATE, the driver tries to convert the string to a date according to the format 'yyyy-MM-dd'. If the string isn't in this format, this can result in a wrong date value. For instance January 2nd becomes February 1st if you have a date as 'dd-MM-yyyy'.
Is there a possibility to give an error, when a string is encountered in stead of a implicit conversion to a date?
With kind regards,
Remco Schoen
|
Re:Strings in column of type DATE |
HXTT Support |
2009-11-04 12:17:56 |
Please download the latest package, which will detect and refused to convert wrong value if you set dateFormat=yyyy-MM-dd .
|
Re:Re:Strings in column of type DATE |
Remco Schoen |
2009-11-06 02:00:11 |
This still fails in version 2.2.103, even with the new parameter and the correct format.
Is it just possible to throw an exception when a string is encountered in a DATE column?
The ODBC driver from Microsoft doesn't try to convert strings to a date, but returns NULL in such cases. We think this is also unwanted behaviour, because the user isn't informed, that he has faults in his data.
|
Re:Re:Re:Strings in column of type DATE |
HXTT Support |
2009-11-10 05:53:03 |
>Is it just possible to throw an exception when a string is encountered in a
>DATE column?
HXTT Text (CSV) latest package will do such action.
|
Re:Re:Re:Re:Strings in column of type DATE |
Remco Schoen |
2009-11-11 06:39:52 |
I tried this in version 2.2.104 and an error is not thrown, the wrong date is still returned.
|
Re:Re:Re:Re:Re:Strings in column of type DATE |
HXTT Support |
2009-11-11 07:19:48 |
But in my test, it throws the error. Please paste you test data and jdbc url.
|
Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
Remco Schoen |
2009-11-11 07:39:44 |
I see now that you are talking about the Text-driver and this about the Excel-driver, could that explain it maybe?
I do have test-data, but that is an Excel-file and I can not paste that.
|
Re:Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
HXTT Support |
2009-11-11 07:44:02 |
Yeah. It seems that HXTT Excel need an ignoreDirtyData connection property too. We will test and give a solution.
|
Re:Re:Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
HXTT Support |
2009-11-13 05:38:59 |
Please try the latest package, which HXTT Excel complemented also dateFormat connection property.
|
Re:Re:Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
Remco Schoen |
2009-12-09 07:32:23 |
Sorrty for the late response.
This parameter works fine.
We do have another request about this. Usually you will start without this parameter and won't directly notice that there are strings in a column with dates. Is it possible that if you don't supply this parameter and a string is encountered to throw an exception? Resolving the exception could be done by changing the Excel-sheet or start using this parameter.
|
Re:Re:Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
HXTT Support |
2009-12-16 04:18:59 |
>Is it possible that if you don't supply this parameter and a string
>is encountered to throw an exception?
The default format is 'yyyy-MM-dd', and you needn't to set.
|
Re:Re:Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
Remco Schoen |
2009-12-24 04:55:36 |
The thing is, that I would like to know, if there is a string in a date column and that I only can get it to work by doing an explicit action. But perhaps an extra connection parameter would be more clear. For instance that it will throw an exception by default and that with the parameter set you can convert it to a date.
With this parameter set, you can know your Excel-sheet also has strings in a date column, but that you can accept this.
|
Re:Re:Re:Re:Re:Re:Re:Re:Strings in column of type DATE |
HXTT Support |
2009-12-24 06:45:48 |
>For instance that it will throw an exception by default and that with the
>parameter set you can convert it to a date.
It will throw an excepiton. For instance if maxScanRows=10, but it meet a string value at row 12.
>With this parameter set, you can know your Excel-sheet also has strings in a date
>column, but that you can accept this.
HXTT Excel supports date, int, doulbe, and string in the same column, and will think it's an object type.
|