Search and Replace in MS SQL Server 2000?

Hi all,

I think this should be fairly stright forward...I hope...

I have a database with a table that contains lots of records which frequently include the word "example". So:

"This is an example record"

How can I automatically replace every use of "example" with "actual", so that record becomes:

"This is an actual record".

Any thoughts?

Thanks!
RhubarbAsked:
Who is Participating?
 
eclipse2kConnect With a Mentor Commented:
Mhh ok i guess you need single quotes


Update MyTable
Set MyRecord = Replace(MyRecord, 'example', 'actual')
0
 
eclipse2kCommented:
Update MyTable
Set MyRecord = Replace(MyRecord, "example", "actual")
--here optional WHERE ....



eclipse2k
0
 
RhubarbAuthor Commented:
It turns out the data was in a Text datatype and that didn't work.

Ended up using code from http://www.sqlteam.com/item.asp?ItemID=15528

I don't know what happens to the points now!
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
RhubarbAuthor Commented:
Ah, what the hell - between us we have a full answer for any situation I think.

Ta for the advice.
0
 
eclipse2kCommented:
thanks for the points Rhubarb!
well i think i would have helped but i didnt knew about the text field.
thanks anyway
0
 
RhubarbAuthor Commented:
No problem, my own fault for not researching fully before posting - thanks again.
0
All Courses

From novice to tech pro — start learning today.