Re: search/replace in update - Mailing list pgsql-sql

From Josh Berkus
Subject Re: search/replace in update
Date
Msg-id web-71932@davinci.ethosmedia.com
Whole thread Raw
In response to search/replace in update  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
List pgsql-sql
Gary,

> This means that e.g. all mobile numbers that used to start 0589 now 
> start 07889.
> 
> Is there a way in SQL to update the phone number in-place?

Postgresql has a nifty string substitution function.  For this and other
character manipulation functions, see:

http://www.postgresql.org/idocs/index.php?functions-string.html

You should be able to fairly easily swap out "07889" and replace it with
"0589".

-Josh



______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Vivek Khera
Date:
Subject: Re: Timestamp without time zone
Next
From: Alex Pilosov
Date:
Subject: Re: Re: Timestamp without time zone