Re: How to Convert VarChar to Date in PgSQL

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: How to Convert VarChar to Date in PgSQL
Дата
Msg-id 49B65870.60807@iol.ie
обсуждение исходный текст
Ответ на How to Convert VarChar to Date in PgSQL  ("Venkat Rao Tammineni" <vtammineni@roulacglobal.com>)
Список pgsql-general
On 10/03/2009 12:07, Venkat Rao Tammineni wrote:
>   I have one table which has lot of data.In the same table I have one
> varchar filed. I want to convert into Date data type? Is It possible to
> convert varchar to date datatype with out loosing data.Please guide me.I am
> waiting for your great response.

If the varchar is already in the format you need (yyyy-mm-dd) then you
ought to be able just to cast it:

   '2009-03-10'::date

If not, you may need to do some clever things with regular expressions
first to get it into this format, and then cast it.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

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

Предыдущее
От: "Venkat Rao Tammineni"
Дата:
Сообщение: How to Convert VarChar to Date in PgSQL
Следующее
От: Jaume Sabater
Дата:
Сообщение: Re: [ADMIN] How to Convert VarChar to Date in PgSQL