|
Posted by Hugo Kornelis on 11/23/06 23:24
On Thu, 23 Nov 2006 13:29:02 -0500, serge wrote:
(snip)
>We would like to know what you think of this approach
>and if you know a simpler way of doing it.
Hi Serge,
First: thanks for posting the necessary SQL statements to recreate your
situation on our computers.
To your question: if you need to return different sets of columns under
different circumstances, I'd use different stored procedures for each
result set. The use of dynamic SQL as in your example has some downsides
and some risks that you should avoid if at all possible.
See http://www.sommarskog.se/dynamic_sql.html
--
Hugo Kornelis, SQL Server MVP
Navigation:
[Reply to this message]
|