Solved

Varchar Limit of 255 characters

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL Delete Query 9 30
sql server concatenate fields 10 31
VB.NET 2008 - SQL Timeout 9 22
Query to capture 5 and 9 digit zip code? 4 20
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

813 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

13 Experts available now in Live!

Get 1:1 Help Now