From: Raymond O'Donnell <rod@iol.ie>
To: Venkat Rao Tammineni <vtammineni@roulacglobal.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: [GENERAL] How to Convert VarChar to Date in PgSQL
Date: Tue, 10 Mar 2009 12:09:20 +0000
Message-ID: <49B65870.60807@iol.ie> (raw)
In-Reply-To: <005901c9a178$d00c3c20$7024b460$@com>
References: <005901c9a178$d00c3c20$7024b460$@com>
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
------------------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: rod@iol.ie, vtammineni@roulacglobal.com, pgsql-general@postgresql.org
Subject: Re: [GENERAL] How to Convert VarChar to Date in PgSQL
In-Reply-To: <49B65870.60807@iol.ie>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox