Using CSVREAD with a tab delimiter

172 views
Skip to first unread message

Ryan

unread,
Nov 29, 2014, 4:14:31 PM11/29/14
to h2-da...@googlegroups.com
Hi,

I'm trying to use CVSREAD to read a file separated by tabs into a four column table.
The four datatypes of the columns are int, bigint, tinytext, datetime.
I'm using Java to execute the commands.

CSVREAD(~\\example\\file.tsv', null, 'UTF-8', chr(9))

I am getting a problem with this specific record:
2615    3320534942    "What's foursquare?" Todd: "It's Dungeons & Dragons for drunks."    2009-08-14 21:01:30

The error is:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Cannot parse "TIMESTAMP" constant "Todd: ""It's Dungeons & Dragons for drunks."""; SQL statement:
 -- row #628 ('2615', '3320534942', 'What''s foursquare?', 'Todd: "It''s Dungeons & Dragons for drunks."') [22007-182]

At first glance is appears to be separating using quotes, but I don't know why.
I've checked that the record contains only three tabs and they are in the right places.

Any ideas?
Thanks

Noel Grandin

unread,
Dec 1, 2014, 2:58:42 AM12/1/14
to h2-da...@googlegroups.com
set fieldDelimiter to zero, otherwise it will treat the double-quote as a field-delimiter.
Reply all
Reply to author
Forward
0 new messages