Home > Net >  How can I execute a query that can remove all at once the apostrophes in all data stored in my db?
How can I execute a query that can remove all at once the apostrophes in all data stored in my db?

Time:11-28

I have here the select statement query, and shows a thousand values that have apostrophes.

Select * from tblProductList where Description like "% ' %"; 

I did try update some, but it's very time consuming if I did it one by one.

Update tblProductList set Description = "Mamas Hub" where Description = "Mama's Hub";

CodePudding user response:

You're looking for replace() and like

Update tblProductList 
set Description = replace(Description, '''', '')
where Description like '%''%';

Strings are delimited by single quotes ', which can be duplicated to escape them so '' implies ' within the delimited string.

  • Related