Skip site navigation (1) Skip section navigation (2)

Re: How to Convert VarChar to Date in PgSQL

From: Jaume Sabater <jsabater(at)gmail(dot)com>
To: Venkat Rao Tammineni <vtammineni(at)roulacglobal(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: How to Convert VarChar to Date in PgSQL
Date: 2009-03-10 12:11:27
Message-ID: 3786f7bb0903100511t5fe45b63tbe84b502b0d64bbc@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-general
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.

-- 
Jaume Sabater
http://linuxsilo.net/

"Ubi sapientas ibi libertas"

In response to

Responses

pgsql-admin by date

Next:From: A. KretschmerDate: 2009-03-10 12:13:43
Subject: Re: How to Convert VarChar to Date in PgSQL
Previous:From: Raymond O'DonnellDate: 2009-03-10 12:09:20
Subject: Re: [GENERAL] How to Convert VarChar to Date in PgSQL

pgsql-general by date

Next:From: A. KretschmerDate: 2009-03-10 12:13:43
Subject: Re: How to Convert VarChar to Date in PgSQL
Previous:From: Raymond O'DonnellDate: 2009-03-10 12:09:20
Subject: Re: [GENERAL] How to Convert VarChar to Date in PgSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group