Avatar of searchsanjaysharma
searchsanjaysharma
 asked on

How to create a querystring in procedure to insert string with single and double quote

I want to pass a string in procedure containing single quote and/or double quote
Ex:
My data entered in textbox is "I as 'as'  and as "India"

1/ How to pass this as parameter
2/ How to create querystring inside procedure


declare @qs nvarchar(max)
set qs=?
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
Mark Wills

8/22/2022 - Mon
lcohan

declare @qs nvarchar(max)
set @qs='"I as ''as''  and as "India"';
print @qs;

Open in new window


single quotes in a string must be put as two single quotes to show a(1) single quote and double quote is ok as is.
searchsanjaysharma

ASKER
No this i also know but this is of no use.
ASKER CERTIFIED SOLUTION
Mark Wills

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes