You are here: Re: Pass Table as a parameter to a function « MsSQL Server « IT news, forums, messages
Re: Pass Table as a parameter to a function

Posted by Shuurai on 07/30/07 15:16

On Jul 28, 2:03 pm, --CELKO-- <jcelko...@earthlink.net> wrote:
> >> Is it possible to pass a table as a parameter to a function. <<
>
> Please read a book, any book, on data modeling, and RDBMS. A table is
> an entity or a relationship. That would mean you have a magical,
> super function that works on Squids, Automobiles, Britney Spears,
> Geographical locations or anything in the whole of creation.

No; it would much more likely mean that he wants to pass a set of
values to his function. There are various reasons to want something
like this, I'll give you a prime example: When passing mutli-value
parameters in Reporting Services, the most common method is to use IN
- so you might have a parameter @someParam and then in your underlying
queries you'll have WHERE some_column in ( @someParam )

This can lead to performance issues when the number of values in the
parameter are very large, and in some cases can even fail to run
because essentially SRS creates a long comma delimited string; but
there is a limit to the size that string can be. There are
workarounds, of course, but having the ability to simply pass a set
would make things enormously easier, faster, and cleaner - which is
probably why they're including it in SQL 2008.

> Or you have a bad design which you are not showing us. That is what Ia
> m beting.

I am betting your lack of real-world development experience has
rendered you incapable of understanding why someone would need this.

> >> I have to access a temporary table created in an SP in a function <<
>
> No, you do not. You just don't know how to write declarative, non-
> procedural code so you are mimicking a scratch tape with a table that
> appears out nowhere in your data model as if you were still using a
> magnetic tape file system instead of an RDBMS.

I can think of several scenarios in which doing exactly what he is
asking would be necessary - reporting being the most obvious.

 

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

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