Re: UPDATE using LIKE?

From: Phil Huber <phil_at_mtu.edu>
Date: 4 Nov 1994 11:44:09 -0500
Message-ID: <39docp$1e4_at_ctsad5.cts>


bjgelly_at_iccgcc.cs.hh.ab.com wrote:
: is it possible to update a set of records that require wildcards to select?
: for example, i would like to update the records returned from the following
: select statement:
:
: select name from brian.table where name like 'A__B%'
:
: i would like to change the 'A' to a 'B'. the update command does not
: appreciate the 'like' command. i'd prefer to do this in a single query.
: thanks.
:
Try this:

update brian.table
set name = replace(name,'A__','B__')
where name like 'A__B%'

-- 
  +---------------------------------------------------------------------+
  |  Phillip Huber   Analyst/Programmer   Michigan Technological Univ.  |
  |  Internet: phil_at_mtu.edu    Phone:(906)487-2223    Fax:(906)487-2521 |
  +---------------------------------------------------------------------+
Received on Fri Nov 04 1994 - 17:44:09 CET

Original text of this message