Solved

Varchar Limit of 255 characters

Posted on 1998-09-22
1
275 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
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now