Solved

Varchar Limit of 255 characters

Posted on 1998-09-22
1
281 Views
Last Modified: 2010-03-19
Does anyone know a way around the size limit of 255 characters?  I've written a stored procedure with a parameter list.  The parameters are used to build a SQL statement and that statement is used in an EXECUTE.  The problem is that my SQL statements are usually longer than 255 characters.  Any way to get around that?
0
Comment
Question by:StangLady
[X]
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

by:
doubas earned 50 total points
ID: 1090220
hi stanglady-

although it may not be as elegant a solution as what you had hoped for, what you can do is use more than one variable to build your sql statement, and then concatenate them inside the exec:

   exec(@sql1 + @sql2 + @sql3 + ...) -- perfectly legal

this is perfectly legal, and i think it's the only way it can be done.  you can also use literals as well:

   exec("select * from mytable where " + @sqlWhere)

hth,
doug
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

690 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