Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search and Replace in MS SQL Server 2000?

Posted on 2004-10-29
6
Medium Priority
?
574 Views
Last Modified: 2008-03-03
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!
0
Comment
Question by:Rhubarb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12443994
Update MyTable
Set MyRecord = Replace(MyRecord, "example", "actual")
--here optional WHERE ....



eclipse2k
0
 
LVL 4

Accepted Solution

by:
eclipse2k earned 500 total points
ID: 12444002
Mhh ok i guess you need single quotes


Update MyTable
Set MyRecord = Replace(MyRecord, 'example', 'actual')
0
 

Author Comment

by:Rhubarb
ID: 12482073
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Rhubarb
ID: 12525312
Ah, what the hell - between us we have a full answer for any situation I think.

Ta for the advice.
0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12538347
thanks for the points Rhubarb!
well i think i would have helped but i didnt knew about the text field.
thanks anyway
0
 

Author Comment

by:Rhubarb
ID: 12545341
No problem, my own fault for not researching fully before posting - thanks again.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question