Re: [SQL] string to date conversion

2005-04-22 Thread Ramakrishnan Muralidharan
al Message- From: Jerome Alet [mailto:[EMAIL PROTECTED] Sent: Friday, April 22, 2005 2:13 PM To: pgsql-sql@postgresql.org 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 &

Re: [SQL] string to date conversion

2005-04-22 Thread Michael Fuhr
On Fri, Apr 22, 2005 at 11:30:02AM +0200, Jerome Alet wrote: > On Fri, Apr 22, 2005 at 11:21:26AM +0200, Christoph Haller wrote: > > > > select '2005/04/22'::text::timestamp ; > > timestamp > > - > > 2005-04-22 00:00:00 > > (1 row) > > > > works for me. > > It w

Re: [SQL] string to date conversion

2005-04-22 Thread Jerome Alet
On Fri, Apr 22, 2005 at 11:21:26AM +0200, Christoph Haller wrote: > > select '2005/04/22'::text::timestamp ; > timestamp > - > 2005-04-22 00:00:00 > (1 row) > > works for me. It works fine !!! Thanks so much for your help. I missed the '::text' intermediate co

Re: [SQL] string to date conversion

2005-04-22 Thread Christoph Haller
Jerome Alet wrote: > > Hi, > > I'm working on an existing Pg database which, please don't ask why, > stores dates as varchar attributes in the form '/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 > s

Re: [SQL] string to date conversion

2005-04-22 Thread Jerome Alet
On Fri, Apr 22, 2005 at 02:38:43PM +0530, Ramakrishnan Muralidharan wrote: > 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/0

[SQL] string to date conversion

2005-04-22 Thread Jerome Alet
Hi, I'm working on an existing Pg database which, please don't ask why, stores dates as varchar attributes in the form '/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 my