Sunday, March 25, 2012

(long) querry doesn't fit in "query-string" window

hi,

i have worked three days on a query to display all my results in a beautiful report. The query is fine because when i execute it in Query Analyzer i have all results i want to see in my statistics-table in my report...

One thing: it's contains about 100 unioned statements, which results in a super-long query. Performance is OK because it are all 100 very easy statements that are union-ed together.

But, when I copy-paste it in my query-string window/textbox of the report designer, I see that there's a maximum on that textbox lenght, which results in the fact that my long query suddenly stops.

Any solutions?
put it in a stored procedure Smile|||yes of course, but this was not asked by the client.

i tried already to edit the rdl file directly. (i paste my whole query in the xml structure), but then when i ask a report preview via BIDS, the BIDS crashes !!!!!!!!!!!!!!!!

i have no other choice then do the workaround via the stored procedure,
but it is really a bug in microsoft i say, isn't it?

|||

You have another alternative...

Create your query string in embedded code, like this:

Function GetSQL
DIM x AS New System.Text.StringBuilder()
x.Append("SELECT ")
' etc...
RETURN x.ToString()
End Function

... Now your query string looks like this

= Code.GetSQL()

HTH, and yes it works <g>, and when you're trying to create a dynamic query out of a lot of parameters it's a heck of a lot more maintainable/legible, too,

>L<

No comments:

Post a Comment