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 --CELKO-- on 11/24/06 15:04

None of these were good suggestions.

>> .. you can use a table where you actually store the sql with different sets. For example insert table values (3, 'select extended set from sometable') <<

SQL is not meant to be used this way -- it stores data and not code.
Why not use a procedure instead?

>> .. you can pass the actual column names to the procedure and select only those columns etc. or pass a number and parse it to column names etc. <<

You cannot pass column names in T-SQL amd most programming languages.
And you should not do this anyway. You want strong cohesion in a
module (basic Software Engineering, duh!) which means you have a spec
that tells you exactly what the output will be. This "I don't know
what is happening until some random user decides at run time" or
"Briteny Spears, Squid or Automobiles" approach is just plain wrong.

 

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

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