Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Search & Replace

Quote Reply
Search & Replace
Hi all,

I'm trying to Search & Replace the words [Borland] with the word Microsoft in links sql but with no luck (Rows affected: 0)

This is the command I'm using in the monitor program in links sql:

UPDATE Links SET Description = 'Microsoft' WHERE Description = '[Borland]'


Anyone understand mysql commands and can tell me what I'm doing wrong?

Thanks for help!

Quote Reply
Re: [Canoon] Search & Replace In reply to
That assumes [Borland] is the only word in the Description - is that right?

Try:

UPDATE Links SET Description = 'Microsoft' WHERE Description = '%Borland%'

Last edited by:

RedRum: Oct 7, 2001, 8:56 AM
Quote Reply
Re: [RedRum] Search & Replace In reply to
Or you may want:

UPDATE Links SET Description = REPLACE(Description, 'Microsoft', 'Borland');

to replace all occurrences of Microsoft with Borland in the description.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Search & Replace In reply to
I have a lot to learn :)

Happy thanksgiving BTW. Shame that the US has to go and bomb Kabul on the same day!
Quote Reply
Re: [Alex] Search & Replace In reply to
Wow, I said this stuff was confusing, I'm sure I had the syntax right!

Thanks for the commands, all work as expected :-)

I found I could also REMOVE certain words from the description by simply leaving the last section blank.:

UPDATE Links SET Description = REPLACE(Description, 'Microsoft', ' ');

Very useful command, thanks again.


Last edited by:

Canoon: Oct 8, 2001, 9:04 AM
Quote Reply
Re: [Alex] Search & Replace In reply to
How could I replace the \ to / in the texts?

I tried following:
my $cat_sth = $cat_db->do ("UPDATE lsql_category SET Nonenglish = REPLACE(Nonenglish, '\\', '/')");
But I get error: GT::SQL::error = Failed to execute query... It's a syntax error.

What I did wrong?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...