Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

String Expression 4000 characters limit Expand / Collapse
Author
Message
Posted Monday, December 10, 2012 8:50 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 20, 2013 10:26 AM
Points: 5, Visits: 138
Hi all,

I have a query more than 4000 characters limit .I am setting with variables to the query.while i used the string expression i am getting error like string expression is limited to 4000 characters limit.Is any one have idea about how to eliminate the length limit in expression.

Post #1394667
Posted Monday, December 10, 2012 9:23 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 15,444, Visits: 9,596
Replace the string expression with either a code object or a stored proceduring, depending on what you are trying to do with it.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1394675
Posted Tuesday, December 11, 2012 7:07 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 29, 2014 12:18 PM
Points: 2,818, Visits: 2,561
Fortunately the 4000 character limit is an expression limitation, not a limitation of the number of characters in the string.

I have not done this personally but you might be able to break your expression down into parts and set a variable to each section. For example Var1, Var2, Var3, SQLVar. Then
Var1 = SELECT........
Var2 = FROM.....
Var3 = WHERE....
SQLVar = Var1 + Var2 + Var3

If that doesn't work the other way is to pull the query as suggested above from SQL built as a stored procedure, or from a column in a table that stores the entire query, and then set your variable value to the string returned.
Post #1395106
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse