Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


stored sam

Posted on 1999-07-01
Medium Priority
Last Modified: 2010-03-19

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))

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

Question by:tonytpark
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

simonsabin earned 150 total points
ID: 1096053
You cannot do what you want in that way you will have to do it in 255 chuncks
create procedure ss (@varsql1 varchar(255),@varsql2 varchar(255),@varname varchar(12))
 declare @comma varchar
 select @comma = ","

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

extending the number of Varsql variable as required

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question