[SQL] Is there a way to remove every character but numbers?

2012-02-05 Thread Andreas

Hi,

I need to clean up a text column so that it just contains numbers or the 
"+" sign if it is the first character of the string.


Well, it is needed to normalise up a phone number column.
So it'd be great if the "+" could be transformed in "00" in the same step.

--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Is there a way to remove every character but numbers?

2012-02-05 Thread Viktor Bojović
On Sun, Feb 5, 2012 at 2:47 PM, Andreas  wrote:

> Hi,
>
> I need to clean up a text column so that it just contains numbers or the
> "+" sign if it is the first character of the string.
>
> Well, it is needed to normalise up a phone number column.
> So it'd be great if the "+" could be transformed in "00" in the same step.
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-sql
>

try regexp_replace


-- 
---
Viktor Bojović
---
Wherever I go, Murphy goes with me