Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Monster select
Message
From
20/11/2001 05:57:45
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Monster select
Miscellaneous
Thread ID:
00583822
Message ID:
00583822
Views:
59
I'm trying to build a dynamic select statement in a stored procedure, but I'm running out of a varibles max length ie 8000 characters after about 2 passes though the loop. I've enclosed a simple example.

DECLARE @statement varchar(8000)
Set @statement = 'SELECT .....INTO ....FROM .....'

WHILE -- 24 to 48 times
BEGIN

-- This select is about 6000 characters in length
SET @statement = @statement + 'LEFT OUTER JOIN ( SELECT ........)'

END

EXECUTE ( @statement )


Any help will be appreciated

James
Next
Reply
Map
View

Click here to load this message in the networking platform