all groups > sql server programming > november 2005 >
You're in the

sql server programming

group:

string length problem.



string length problem. Toby
11/18/2005 8:41:01 PM
sql server programming: Hello everyone,
I've written a procedure to generate XML dynamically(structure).
The procedure has a parameter which says the no of levels the xml would have.
so i've wriiten the query as string in a loop
declare @query varchar(8000)
while @min<=@max
begin
set @query=@query+'seleect ...... where .....level='+@min
set @min=@min+1
end
exec (@query)

now the problem is as the level increases the size of the query increases
beyond 8000.
so no xml is generated.

I'd be glad if someone could tell me how to manage this problem.
is there anyother way to generate the query and execute.

thanks and regards,
Toby

RE: string length problem. ML
11/19/2005 4:09:02 AM
You're building the query instead of building the result. Why?

What exactly are you trying to do? Please post DDL and sample data.

Ever heard of FOR XML?


AddThis Social Bookmark Button