I am using SQL server 2005 and using the northwind database. I need the supplier id of Grandma Kelly's Homestead and I used this query:

select supplierid from suppliers
where companyname ='Grandma Kelly''s'' Homestead'

I checked the link Escaping a single quote in SQL Server, but I can't find an answer.

I used the two single quotes but it didn't work since the query is executing but it doesn't return a value.

How can I escape the single quote and retrieve the value? I would also like to know how to insert the values into the table having quotes

  • 1
    Should it be = 'Grandma Kelly''s Homestead'? No apostrophe(s) after the "s" (which don't make sense in English anyway.
    – Vérace
    Jun 18, 2015 at 9:54

1 Answer 1


I think you just meant:

select supplierid from dbo.suppliers
where companyname ='Grandma Kelly''s Homestead';

(In other words, there was only one apostrophe to replace.)


Not the answer you're looking for? Browse other questions tagged or ask your own question.