2

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, ''', ''')

Mike
  • 713
  • 6
  • 20
  • 41

1 Answers1

6

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))
Martin Smith
  • 438,706
  • 87
  • 741
  • 845