List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 14 1999 2:19pm
Subject:Re: replace text?
View as plain text  
At 10:55 AM +0100 11/14/99, Søren Merser wrote:
>I wanna go through my database, searching a char(250) field for any
>occurences of the letter combination 'Ps' and do a replace to ' F', leaving
>the text otherwice untouched.
>How do I write a SQL statement? or do I need to do some C/perl/awk script to
>do the job?  or can I pass the database file itself through awk/sed using a
>regular expressions?

I'd probably use UPDATE and the REPLACE() function:

UPDATE tbl_name
SET col_name = REPLACE (col_name, 'Ps', ' F')
WHERE col_name LIKE '%Ps%'

The WHERE clause isn't strictly necessary, actually.

Paul DuBois, paul@stripped
replace text?Søren Merser14 Nov
  • Re: replace text?Paul DuBois14 Nov