Hi,
I have tried the same in PostgreSQL 8.0.1 and it is working fine. I have used
following example for testing
create table test1
(
date varchar(10)
)
insert into test1 values('2005/04/22')
select date::timestamp from test1
Regards,
R.Muralidharan
-----Original Message-----
From: Jerome Alet [mailto:[EMAIL PROTECTED]
Sent: Friday, April 22, 2005 2:13 PM
To: [email protected]
Subject: [SQL] string to date conversion
Hi,
I'm working on an existing Pg database which, please don't ask why,
stores dates as varchar attributes in the form 'YYYY/MM/DD'
I'm not allowed to modify the tables to use 'timestamp' instead,
so I'd like to convert on the fly when retrieving datas with
select.
When I do :
select mydatefield::timestamp from mytable;
There's an error saying that converting from varchar to date is
not possible
How can I do this ?
Thanks in advance
Jerome Alet
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match