Re: [despammed] converting varchar to integer

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [despammed] converting varchar to integer
Date: 2005-08-17 16:46:01
Message-ID: 5.2.1.1.0.20050817124436.02d4c970@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 05:30 AM 8/17/05, Kretschmer Andreas wrote:

>tv(at)fuzzy(dot)cz <tv(at)fuzzy(dot)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;

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Lane Van Ingen 2005-08-17 16:54:50 Is it This Join Condition Do-Able?
Previous Message Halley Pacheco de Oliveira 2005-08-17 10:46:05 Re: converting varchar to integer