Link to home
Create AccountLog in
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=?
Avatar of lcohan
lcohan
Flag of Canada image

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.
Avatar of searchsanjaysharma
searchsanjaysharma

ASKER

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

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account