Try something like this: UPDATE tablename SET url = concat("programs", substring(url,12)) where url like ("disciplines/%");
Andy > -----Original Message----- > From: Craig Harding [mailto:[EMAIL PROTECTED] > Sent: 20 June 2003 17:31 > To: [EMAIL PROTECTED] > Subject: search and replace. > > > Is there is a way to do a search and replace on the mysql cmd prompt? I > want to replace text in about 20 rows that has the same pattern with a > replacement. > > I have a table that has a column 'name' and a column 'url' which holds > menu items for a website. Both columns are type varchar. > > 'url' has about 20 rows starting with 'disciplines/someurl' and I want > to replace 'disciplines' with 'programs'. Is there a way to do this in > mysql? I know I can do it in php, but it would be cool to do it, (and > probably faster) to do it in mysql. > > I know how do use the regexp for SEARCHING, but can I do a replace on > the same cmd with an UPDATE? > > thanks in advance, > > Craig. > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]