Thanks...that worked out well. Most of the time, it's the GROUP BY in our app that's variable at runtime.
I have a follow-up question. Our apps allows users to report off of (potentially) hundreds of selections that are picked from a MOVER-style form. We need to get the list of integer keys for each user-selection back into SQL Server, because the eventually query involves each of these integer keys.
What I'm doing is creating a temp table in SQL, then doing an INSERT for the integer key for each user-selection (it's a list of accounts and a list of items). Then I have a stored proc that runs against a historical transaction file and the list of integer keys from the user selections.
This works great...when someone has a fast connection to a corporate database. What I don't know is how that would work if someone is working off of, say, a fractional T1.
What is the best (i.e. fastest) way to get a potentially long list of user selections to the back-end for querying? I haven't tried an updatable cursor yet, but have wondered if that would be faster.
Thanks in advance,
Kevin