Replacing Specific Characters in a Text String

  • Hello,

    I have a situation in which I need to replace apostrophe characters with a space, within a text string. I need to do this edit in a nvarchar 20 field that contains last names.

    For example, if I have a lastname of O'Neil, that name needs to be edited to become O Neil.

    I am working with some String Functions now, but I wanted to check to see how others might handle this.

    Thanks

    CSDunn

  • Why not just use REPLACE()?

    
    
    UPDATE People
    SET LastName = REPLACE(LastName,'''',' ')
    WHERE LastName LIKE '%''%'

    --Jonathan



    --Jonathan

  • I glanced at REPLACE, and it didn't occur to me at the time that I could just use the 'LastName' field name in the first expression.

    Thanks for your help!

    CSDunn

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply