开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜