MS SQL Server compatibility would be nice, but for me it's quite
strange to automatically convert an empty string to NULL, plus char(0)
to an empty string. How to encode char(0) then? Why not use a special
token (such as 'NULL') for NULL?
What about converting char(0) to an empty string in the query? Example:
create alias convert0 as $$
String convert0(String s) {
return s.length() == 0 ? null : s.charAt(0) == 0 ? "" : s;
}
$$
INSERT INTO FOO.foo (STREET,STREETAD,CITY,ST,ZIP,PHONE)
SELECT convert0(street), streetad, city, st, zip, phone
FROM CSVREAD('C:\temp\testdata\foo_foo.dat', 'STREET|STREETAD|CITY|ST|ZIP|
PHONE', 'UTF-8', '|', '\n');
Regards,
Thomas