Home Forums SQL Server 7,2000 SQL Server Newbies extracting column values when a part of the column value is known RE: extracting column values when a part of the column value is known

  • Note that you might replace strings you don't want them to be replaced.

    INSERT INTO @test-2(TEST_STRING)

    VALUES

    ('I am a bad Gal')

    ,('I am a good Gal')

    ,('Oh my goodness! There''s no more goodwill')

    ,('He''s a patient with Osgood–Schlatter disease');

    SELECT

    *, REPLACE(TEST_STRING, 'good', 'bad')

    FROM @test-2 T

    WHERE T.TEST_STRING LIKE '%good%';

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2