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?
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).
Use:
REPLACE ( string_expression , string_pattern , string_replacement )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With