karthik parcha

karthik parcha

  • NA
  • 153
  • 91.1k

How to replace single quotes in SP

Sep 12 2011 5:39 AM
Hi
this is my query
  SELECT AccountNo, BusinessName FROM CustomerDetails WITH (NOLOCK) WHERE BusinessName like @BusinessName + '%' ...
When i execute my SP output Shouldbe like this
AccountNo  BusinessName
10509  Anderson's "The Grocery Store".......
But when iexecut emy SP
--EXEC DBSP_SF_GetAccountsLikeAccNo '10509','Anderson's "The Grocery Store"'
Getting error like...........
Incorrect syntax near 's'.
Unclosed quotation mark after the character string ''.

So when i execute my SP adding another Apostrophe after anderson
like EXEC DBSP_SF_GetAccountsLikeAccNo '10509','Anderson''s "The Grocery Store"'
ite executed so i want to replace how to replace  using replace function in SP
plz help me

Answers (22)