stored sam


I have little problem with following stored procedure
It's giving me error cannot convert text into varchar
and I want to concat the two parameters
I tried all convertion options
Give me some suggestions....



create procedure ss (@varsql text,@varname varchar(12))
as

select @varsql=@varsql+","+@varname+")"

exec(@varsql)
tonytparkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
simonsabinConnect With a Mentor Commented:
You cannot do what you want in that way you will have to do it in 255 chuncks
i.e
create procedure ss (@varsql1 varchar(255),@varsql2 varchar(255),@varname varchar(12))
as
 declare @comma varchar
 select @comma = ","

exec(@varsql1 + @varsql2+@comma+@varname )

extending the number of Varsql variable as required
0
All Courses

From novice to tech pro — start learning today.