sql - H2 DB CSVREAD command converting value to date before placing into VARCHAR -


i attempting load tab delimited text file contains column of values happen date, aren't. appears csvread command scans row, converts text value in column java.sql.date, , sees target column varchar , executes tostring() obtain value...which not need. need raw unconverted text no date processing whatsoever.

so, there way turn off "helpful date-like column conversion" in csvread command?

here's simplest case can make demonstrate undesired behavior:

create table x   (     name varchar not null     value varchar   )   select *  csvread('c:\myfile.tab', null, 'utf-8', chr(9)) ; 

the file contains 3 rows, header , 2 records of values:

name\tvalue\n x\t110313\n y\t102911\n 

any assistance on how can bypass overhelpful part of cvsread appreciated. thank you.

(it seems found out yourself, anyway):

for csvread, columns strings. csvread function or database not try convert values date, or in other way try detect data type. database ask for, read data string in case.

if want convert column date, need explicitly, example:

create table x(name varchar not null, value timestamp) select *  csvread('c:\myfile.tab', null, 'utf-8', chr(9)); 

if non-default parsing needed, use:

create table x(name varchar not null, value timestamp) select "name", parsedatetime("value", "m/d/y") v  csvread('c:\myfile.tab', null, 'utf-8', chr(9)); 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -