From: Frank Bax <fbax@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Re: [despammed] converting varchar to integer
Date: Wed, 17 Aug 2005 12:46:01 -0400
Message-ID: <5.2.1.1.0.20050817124436.02d4c970@pop6.sympatico.ca> (raw)
In-Reply-To: <20050817093029.GA1647@kaufbach.delug.de>
References: <1124235288.43027818cb6e3@email.gigaweb.cz>
<1124235288.43027818cb6e3@email.gigaweb.cz>
At 05:30 AM 8/17/05, Kretschmer Andreas wrote:
>tv@fuzzy.cz <tv@fuzzy.cz> schrieb:
>
> > Hi,
> >
> > I have a varchar column, and I need to
> >
> > 1) check the value in it is an integer
> > 2) get the integer value (as integer)
>
>test=# update foo set n = substring(t , '[0-9]')::int;
I think you meant:
update foo set n = substring(t , '[0-9]+')::int;
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: fbax@sympatico.ca
Subject: Re: [despammed] converting varchar to integer
In-Reply-To: <5.2.1.1.0.20050817124436.02d4c970@pop6.sympatico.ca>
References: <1124235288.43027818cb6e3@email.gigaweb.cz> <5.2.1.1.0.20050817124436.02d4c970@pop6.sympatico.ca>
* 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