Solved

Search and Replace in MS SQL Server 2000?

Posted on 2004-10-29
564 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
Question by:Rhubarb
    6 Comments
     
    LVL 4

    Expert Comment

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



    eclipse2k
    0
     
    LVL 4

    Accepted Solution

    by:
    Mhh ok i guess you need single quotes


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

    Author Comment

    by:Rhubarb
    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
     

    Author Comment

    by:Rhubarb
    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
    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
    No problem, my own fault for not researching fully before posting - thanks again.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Cisco Complete Network Certification Training

    If you’re an IT engineer or technician, it's time you take your career to the next level. This elite training bundle is brimming with all of the information you need to learn to sit for Cisco CNNA, CCNP, and CCENT certification exams.

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    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.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    856 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now