Re: search/replace in update

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: search/replace in update
Date: 2001-06-14 14:52:08
Message-ID: web-71932@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Vivek Khera 2001-06-14 14:57:20 Re: Timestamp without time zone
Previous Message DHSC Webmaster 2001-06-14 14:49:44 Re: performance issues