Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5EEqDE31829 for ; Thu, 14 Jun 2001 10:52:13 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.1) with HTTP id 71932; Thu, 14 Jun 2001 07:52:08 -0700 From: "Josh Berkus" Subject: Re: search/replace in update To: Gary Stainburn Cc: pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.1 Date: Thu, 14 Jun 2001 07:52:08 -0700 Message-ID: In-Reply-To: <01061409403400.06009@gary.ringways.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200106/208 X-Sequence-Number: 3466 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@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco