From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Jaume Sabater <jsabater(at)gmail(dot)com> |
Cc: | Venkat Rao Tammineni <vtammineni(at)roulacglobal(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org |
Subject: | Re: [GENERAL] How to Convert VarChar to Date in PgSQL |
Date: | 2009-03-10 12:16:35 |
Message-ID: | 162867790903100516i1e259d1bl1273c13b25515d9a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
2009/3/10 Jaume Sabater <jsabater(at)gmail(dot)com>:
> On Tue, Mar 10, 2009 at 1:07 PM, Venkat Rao Tammineni
> <vtammineni(at)roulacglobal(dot)com> 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.
>
> An easy solution would be to add a new column to the table, of type
> date, and then execute an update statement that reads, for each row,
> the value in the varchar field and writes the converted value to the
> date field.
>
resp.
alter table someatb alter column columname type date using
to_data(columname, 'YYYY-MM-DD');
regards
Pavel
> --
> Jaume Sabater
> http://linuxsilo.net/
>
> "Ubi sapientas ibi libertas"
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-03-10 12:31:31 | Re: Urgent PST time changing tonight |
Previous Message | Pavel Stehule | 2009-03-10 12:14:07 | Re: [GENERAL] How to Convert VarChar to Date in PgSQL |
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2009-03-10 12:22:56 | Re: intermittant performance problem |
Previous Message | Pavel Stehule | 2009-03-10 12:14:07 | Re: [GENERAL] How to Convert VarChar to Date in PgSQL |