removing single quotes

  • hi all

    my select statement is something like this

    select name

    from table

    result is

    O'Shea

    O'Connor

    ..I would like to know how i can replace the single quotes with empty space in SQL

    so the results will display

    O Shea

    O Connor?

    any ideas?

  • DECLARE @Name varchar(20)

    SET @Name = 'O''Shea'

    SELECT @Name

    SET @Name = REPLACE(@Name, '''', ' ')

    SELECT @Name

    -- may want to replace with 146

    SET @Name = 'O''Shea'

    SELECT @Name

    SET @Name = REPLACE(@Name, '''', CHAR(146))

    SELECT @Name

     

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

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