问题
In SQL Server how do I use an apostrophe in the LIKE operator on a WHERE clause?
Example: WHERE WORD like '%That's why%'
I need to fetch the data that matches to word "That's why" in the WORD column.
Dummy data on WORD Column:
- So that's why we turned back
- and that's why it didn't work
When I use '%That\'s why%'
, I get
Incorrect syntax near 's'
When I use '%That''s why%'
, I get the following error
Incorrect syntax near 's why%'
回答1:
WHERE WORD like '%That''s why%'
Example (SQL Server):
来源:https://stackoverflow.com/questions/64999187/how-to-use-apostrophe-in-like-operator-on-a-where-clause-example-where-word-l