Friday, February 24, 2012

Include column names in resultset - is it possible?

This is probably not a practical thing to do but I'd like to know if it
is possible
to include the column names as part of the resultset in my stored
procedure? The column
names could be the first row or and the last row of the resultset. The
number of columns
returned is unknown until runtime.
Thanks!
-SydneyAt no point down the line is there a client? Then who needs this data,
anyway...? :)
ML
http://milambda.blogspot.com/|||> The number of columns returned is unknown until runtime.
Why? How can that be? Please, explain.
If the structure of a result set depends on one or more conditions couldn't
you somehow figure out those conditions before executing this ellusive query
?
If you could, you'd know the structure of the result set in advance.
One other (mor logical) method would be to use a standard result set to
cover all options, and then if needed transform the result set after it's
returned from the procedure (or query) to more appropriately fit each
individual situation.
Sounds like sci-fi to me. But I'm willing to help.
ML
http://milambda.blogspot.com/|||ML, thanks for you reply.
See this link why I don't know # of columns in advance.
rl]
ML wrote:
> Why? How can that be? Please, explain.
> If the structure of a result set depends on one or more conditions couldn'
t
> you somehow figure out those conditions before executing this ellusive que
ry?
> If you could, you'd know the structure of the result set in advance.
> One other (mor logical) method would be to use a standard result set to
> cover all options, and then if needed transform the result set after it's
> returned from the procedure (or query) to more appropriately fit each
> individual situation.
> Sounds like sci-fi to me. But I'm willing to help.
>
> ML
> --
> [url]http://milambda.blogspot.com/" target="_blank">http://groups.google.com/group/micr...a.blogspot.com/|||Some people call this problem sci-fi, others call it a 'crosstab'.
And some people here think words are not important:)
You want to generate the columns dynamically.Now that
people know what you want I'm sure you will get a lot
of wonderful solutions.If you don't want to mess around with
them you can check out the RAC utility which will eliminate the
need to write any code on your part.It will generate your crosstab
magically.You will learn very little but you will keep your job:)
www.rac4sql.net|||Oh, it's a cross-tab query! Well, bring the normalized data to the client an
d
pivot it there. Or is there no client?
ML
http://milambda.blogspot.com/|||There is no client.Gotcha :)
www.rac4sql.net
"ML" <ML@.discussions.microsoft.com> wrote in message
news:AFFA52FB-C614-471D-91F7-E6D512AD5BC9@.microsoft.com...
> Oh, it's a cross-tab query! Well, bring the normalized data to the client
> and
> pivot it there. Or is there no client?
>
> ML
> --
> http://milambda.blogspot.com/

No comments:

Post a Comment