Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,


i have a siring like this ','

I need to assign it in a varchar variable in store procedure.How can i do this???


SQL
declare @asd varchar(50)
set @asd= ',';
print @asd



while execuing this am getting result as ,

But i need both single quotes and comma .. Can anyone help me?????
Posted

can you try like this...

SQL
declare @asd varchar(50)
set @asd= ''',''';
print @asd


it will resulted like this...

','
 
Share this answer
 
v2
Comments
Aswathi Narayan 4-Jul-12 1:45am    
Hi..
i hav a string like this

in (select convert(varchar,value) from split(class,','))

In need to print like this while executing the below code .. can u help me???
declare @common varchar(50);
set @common='in (select convert(varchar,value) from split(class,''','''))'
print @common;
Tejas Vaishnav 4-Jul-12 1:47am    
what would be the out put you want.?
Aswathi Narayan 4-Jul-12 1:50am    
in (select convert(varchar,value) from split(class,','))


i need to assign this in a variable declared as varchar
Regarding...

Hi.. i hav a string like this in (select convert(varchar,value) from split(class,',')) In need to print like this while executing the below code .. can u help me??? declare @common varchar(50); set @common='in (select convert(varchar,value) from split(class,''','''))' print @common;


please refer this...

SQL
declare @common varchar(100);
set @common='in (select convert(varchar,value) from split(class,'',''))'
print @common;



what i chnage is increase the size of @common to 100 and remove one quot from ''','''


result will be like this...

in (select convert(varchar,value) from split(class,','))
 
Share this answer
 
v2
Comments
Aswathi Narayan 4-Jul-12 1:58am    
Thank u very much

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