2

The update statement below is throwing an error because of the ' within the ''

UPDATE Table 
SET [Company Name] = 'O'Donald Media Inc' 
WHERE [Company Name] = 'O'Donald Media  Inc'

Does anyone have a way to handle this?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
hansolo
  • 903
  • 4
  • 12
  • 28

1 Answers1

5

When writing SQL by hand, use 'O''Donald Media Inc' for the string syntax. The '' sequence in a SQL string literal is a special encoding for a single apostrophe.

However, if done programmatically (ie. from code), use placeholders.

Community
  • 1
  • 1
user2864740
  • 60,010
  • 15
  • 145
  • 220