Hi,

The nullString is only used for non-delimited values. I will document this.
Example:

A,B,C
1,NULL,X
2,,Y
"3","NULL","Z"

If the nullString is NULL, Column B of row 1 is null. Column B of row 3 is
the literal "NULL". I don't plan to change this behavior.

If you want to convert quoted empty strings to NULL, you need to convert it
yourself. It doesn't make sense to add such a feature to H2 in my view, as
it would make things more complicated for a very unusual use case.

Regards,
Thomas


On Tue, Aug 7, 2012 at 12:50 AM, spacewiz <[email protected]> wrote:

> Hello,
>
> I saw several  other posts complaining about simialr issues, however did
> not find a solution that worked for me.
>
> My program gets an input file from a 3rd party (which I cannot modify)
> The file is TAB separated, and in addition values are often surrounded by
> double quotes.
> I use  CSVREAD function to import that file as an H2 database table. The
> problem is that downstream logic depends on empty strings (represented as
> "" between tabs in the input file) to be converted to NULL, but they are
> imported as empty strings.
>
> Specifying nullString="" does not work. I tried a number of things,
> includin CHAR(34) etc.. .nothing works.
> Looks like a bug?
>
>
>
> Here are my test statements that work with the attached sample input file.
> -------
> DROP TABLE IF EXISTS sample_table;
>
> CREATE MEMORY TABLE IF NOT EXISTS sample_table
> AS SELECT * FROM CSVREAD('sample_tsv_with_double_quotes.csv',null,
> STRINGDECODE('caseSensitiveColumnNames=true charset=UTF-8 nullString=""
> fieldSeparator= '));
>
> SELECT * FROM sample_table ;
> -------
>
> All "" values  are imported as empty strings instead of nulls :(
>
> Sample input file is attached!
>
> Thank you!
> Oleg
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/vjw5dXW2SfUJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to