Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having issues executing a SQL statement from a stored proc having single quotes. Here is my query from a stored procedure that I am executing.

SQL
DECLARE  @questionDesc VARCHAR(MAX)
Set @questionDesc=REPLACE(@question,''''',''')
insert into tQuestions values(@questionDesc)



INPUT: ''''Monday''''

Required output: 'Monday'
Posted

1 solution

SQL
DECLARE  @questionDesc VARCHAR(MAX)
Set @questionDesc=REPLACE(@question,'''''''''','''')--for one ' use two '' ... dark single quote is expressing starting & ending of string.
insert into tblTestQuestions values(@questionDesc)

Happy Coding!
:)
 
Share this answer
 
Comments
apr1234 7-May-13 6:38am    
Thanks Aarti!!
Aarti Meswania 7-May-13 6:39am    
Welcome!
Glad to help you! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900