Remove all apostrophes in field with T-SQL

sql-server, t-sql

Solution

Use replace, here's an example:

declare @value varchar(40)
select @value = 'It''s a good day. He''s so happy.'


select @value, replace(@value, '''', '')

If you want to update a column in a table, do it like this:

update table
set column = replace(column, '''', '')

It replaces all occurrences of a specified string value (in your case apostrophes) with another string value (in your case empty string).

Problem

I have a value in database and it contains a few apostrophes like........... It's a good day. He's so happy. Result must be..... Its a good day. Hes so happy. What T-SQL statement can I use to remove the apostrohe?

Original source