Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post

    Thumbs down search table for apostrophe

    Code:
    SELECT * FROM `dbo_tp_countryname` where CountryName like  '%'''%'
    How do i search a table which has a apostrophe in it? I have tried the above, but it doesnt work.

    My error is
    Error: You have mismatched `'`

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need to escape the apostrophe you're searching for:

    Code:
    SELECT
     foo
    FROM
     table
    WHERE
     bar LIKE '%\'%'


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •