You are here: Re: How to build a procedure that returns different numbers of columns as a result based on a parameter « MsSQL Server « IT news, forums, messages
Re: How to build a procedure that returns different numbers of columns as a result based on a parameter

Posted by Erland Sommarskog on 11/24/06 22:47

Hugo Kornelis (hugo@perFact.REMOVETHIS.info.INVALID) writes:
> 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.

Personnally, I agree with the idea of keeping it all in the same
procedure. Splitting it up over several, increases the risk that the
the branches one day deviates from each other when they shouldn't.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация