Errors when parsing DATE and TIME.

1,760 views
Skip to first unread message

Pierre8r

unread,
Mar 18, 2008, 3:06:55 PM3/18/08
to H2 Database
Hello,

Because the DATE format into my texte file is mm/dd/yyyy and not
yyyy-mm-dd, when I run my SQL code, I have the following message error
from SQuirreL :

Error: Cannot parse date constant 10/01/2007, cause: format yyyy-mm-dd
[90009-68]
SQLState: 90009
ErrorCode: 90009

How to parse this date and time without error ?
The best will be to have, date and time in the same data ( a
TIMESTAMP ?).



My texte file

10/01/2007,23:46,2.04345,2.0436,2.04345,2.04345,-1
10/01/2007,23:47,2.04345,2.04345,2.04345,2.04345,-1
10/01/2007,23:48,2.04345,2.04345,2.04345,2.04345,-1
10/01/2007,23:49,2.04345,2.04345,2.0433,2.0433,-1
10/01/2007,23:50,2.0433,2.0433,2.04325,2.04325,-1
10/01/2007,23:51,2.04325,2.04325,2.04325,2.04325,-1
10/01/2007,23:52,2.04325,2.04325,2.04325,2.04325,-1
10/01/2007,23:53,2.04325,2.04325,2.04325,2.04325,-1

My SQL code

DROP TABLE IF EXISTS RAWDATAS;

CREATE TABLE RAWDATAS (
DATE DATE,
TIME TIME,
OPEN DOUBLE,
HIGH DOUBLE,
LOW DOUBLE,
CLOSE DOUBLE,
VOLUME BIGINT
);

INSERT INTO RAWDATAS SELECT *
from CSVREAD('K:\\12-H2-Data\
\GBPUSD-1mn.txt','DATE,TIME,OPEN,HIGH,LOW,CLOSE,VOLUME',null,',');

Regards,

Pierre8r

Thomas Mueller

unread,
Mar 19, 2008, 4:31:25 PM3/19/08
to h2-da...@googlegroups.com
Hi,

> How to parse this date and time without error ?

See http://h2database.com/html/functions.html#parsedatetime

Regards,
Thomas

priyanka

unread,
Oct 22, 2012, 4:59:26 AM10/22/12
to h2-da...@googlegroups.com
hello sir,

h2 date format is this DATE '2004-12-31'

how to parse in dd/mm/yyyy
Iam getting this exception

Cannot parse "DATE" constant "21/01/2012"; SQL statement:

I saw the document but unable to understand how to parse

 can you give an example please...

thank u....

priyanka priya

unread,
Oct 22, 2012, 5:51:21 AM10/22/12
to h2-da...@googlegroups.com
hello sir,

I tried this example

but getting error

SELECT *
FROM pet
WHERE parsedatetime(birth, 'dd/mm/yyyy') 

Error parsing "2012-02-21"; SQL statement:
SELECT *
FROM pet
WHERE parsedatetime(birth, 'dd/mm/yyyy') [90014-169]
90014/90014 (Help)

how to parse please help me

Thanks in advance

--
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/-/lDV4mAJexIoJ.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Message has been deleted

Thomas Mueller

unread,
Oct 23, 2012, 2:22:02 PM10/23/12
to h2-da...@googlegroups.com
Hi,


Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages