开发者

Replace the ascii apostrophe with a real apostrophe in a sql database

开发者 https://www.devze.com 2023-01-28 03:33 出处:网络
I am converting my classic asp to .Net using parameterized queries. Myproblem is that in my classic apps I would replace the apostrophe with the ascii equivelent '

I am converting my classic asp to .Net using parameterized queries. My problem is that in my classic apps I would replace the apostrophe with the ascii equivelent '

Now I would like to replace that value in the database with a real apostrophe. I am not sure how the syntax should be to do this. I can find the ' but I am not sure how to replace. The following is the simple update I am trying to run that errors out.

update tblCustomer set Name = replace(Name, '&am开发者_开发百科p;#39;', ''')


Double up the apostrophe to escape it in a string literal

update tblCustomer set Name = replace(Name, ''', '''')

Or use the char function

update tblCustomer set Name = replace(Name, ''', CHAR(39))
0

精彩评论

暂无评论...
验证码 换一张
取 消