Re: string to date conversion

Поиск
Список
Период
Сортировка
От Ramakrishnan Muralidharan
Тема Re: string to date conversion
Дата
Msg-id 02767D4600E59A4487233B23AEF5C5992A407D@blrmail1.aus.pervasive.com
обсуждение исходный текст
Ответ на string to date conversion  (Jerome Alet <alet@librelogiciel.com>)
Список pgsql-sql
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:alet@librelogiciel.com]
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 '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 majordomo@postgresql.org


В списке pgsql-sql по дате отправления:

Предыдущее
От: Kai Hessing
Дата:
Сообщение: Re: can a function return a virtual table?
Следующее
От: "Bill Lawrence"
Дата:
Сообщение: Re: Getting the output of a function used in a where clause