Home All Groups Group Topic Archive Search About

random numbers of param

Author
1 Dec 2005 9:49 PM
Pohihihi
How can I pass random amount of params in a SP?

Author
1 Dec 2005 9:58 PM
Aaron Bertrand [SQL Server MVP]
This is not a very easy task.  Could you explain what you are trying to
accomplish?  If you are trying to simulate an array, see
http://www.aspfaq.com/2248



Show quote
"Pohihihi" <pohih***@hotmail.com> wrote in message
news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
> How can I pass random amount of params in a SP?
>
Author
1 Dec 2005 10:37 PM
Pohihihi
nice solution. this is what I was looking for. thx.

Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:uoUjKIs9FHA.444@TK2MSFTNGP11.phx.gbl...
> This is not a very easy task.  Could you explain what you are trying to
> accomplish?  If you are trying to simulate an array, see
> http://www.aspfaq.com/2248
>
>
>
> "Pohihihi" <pohih***@hotmail.com> wrote in message
> news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
>> How can I pass random amount of params in a SP?
>>
>
>
Author
1 Dec 2005 10:03 PM
David Portas
"Pohihihi" <pohih***@hotmail.com> wrote in message
news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
> How can I pass random amount of params in a SP?
>

A stored parameter can have upto 2100 parameters according to BOL and they
can all be optional (use defaults). Isn't that enough for you? If not, you
can put the values in a table (probably a good idea anyway if you have
thousands of values).

--
David Portas
SQL Server MVP
--
Author
1 Dec 2005 10:38 PM
Pohihihi
this could be a solution but i can't give 2100 params as i don't know how
many could be passed but surely is to think about as i did not get this
idea.

Show quote
"David Portas" <REMOVE_BEFORE_REPLYING_dpor***@acm.org> wrote in message
news:CK2dnQt7mvo_7xLeRVnyiA@giganews.com...
> "Pohihihi" <pohih***@hotmail.com> wrote in message
> news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
>> How can I pass random amount of params in a SP?
>>
>
> A stored parameter can have upto 2100 parameters according to BOL and they
> can all be optional (use defaults). Isn't that enough for you? If not, you
> can put the values in a table (probably a good idea anyway if you have
> thousands of values).
>
> --
> David Portas
> SQL Server MVP
> --
>
>
Author
1 Dec 2005 10:15 PM
DataGirl
Do you want to pass random values to a stored procedure?

Show quote
"Pohihihi" <pohih***@hotmail.com> wrote in message
news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
> How can I pass random amount of params in a SP?
>
Author
1 Dec 2005 10:40 PM
Pohihihi
yes, but thanks. Aaron's solution works for me.

Show quote
"DataGirl" <m*@oh.my.com> wrote in message
news:eaY4kUs9FHA.4004@TK2MSFTNGP14.phx.gbl...
> Do you want to pass random values to a stored procedure?
>
> "Pohihihi" <pohih***@hotmail.com> wrote in message
> news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
>> How can I pass random amount of params in a SP?
>>
>
>
Author
2 Dec 2005 11:30 AM
Evan Camilleri
We are in year 2005 and SQL still cannot receive an array as parameter!

*shame*


Show quote
"Pohihihi" <pohih***@hotmail.com> wrote in message
news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
> How can I pass random amount of params in a SP?
>
Author
2 Dec 2005 1:59 PM
Aaron Bertrand [SQL Server MVP]
So send XML or a comma separated list.  Oh, the hardship of understanding
the difference between a relational database system and an object oriented
programming language.



Show quote
> We are in year 2005 and SQL still cannot receive an array as parameter!
>
> *shame*
>
Author
2 Dec 2005 2:06 PM
Raymond D'Anjou
"Evan Camilleri" <e7***@yahoo.co.uk.nospam> wrote in message
news:uZelkOz9FHA.3608@TK2MSFTNGP09.phx.gbl...
> We are in year 2005 and SQL still cannot receive an array as parameter!
>
> *shame*

Erland explains it so well:
....T-SQL does have arrays. They are called tables.
Author
2 Dec 2005 4:07 PM
Anith Sen
>> ...T-SQL does have arrays. They are called tables.

That is too misleading, but then such explanations are meant mostly to
simplify the issue and to cater to a wider range of readers.

--
Anith
Author
2 Dec 2005 4:33 PM
Raymond D'Anjou
"Anith Sen" <an***@bizdatasolutions.com> wrote in message
news:OaA35p19FHA.1048@TK2MSFTNGP10.phx.gbl...
>>> ...T-SQL does have arrays. They are called tables.
>
> That is too misleading, but then such explanations are meant mostly to
> simplify the issue and to cater to a wider range of readers.
>
> --
> Anith

Yeah I know. Arrays <> Tables <> XML

When I started using SQL, I had problems too with the fact that I couldn't
pass arrays to a stored procedure especially since most of my procedures are
called from Web pages. At the beginning, some pages would call the same
procedure 100 times at a go. Then someone pointed me to Erland's article,
http://www.sommarskog.se/arrays-in-sql.html and I haven't had a problem with
arrays since.
Aaron has an excellent article too as he kindly pointed out in this thread.
Author
2 Dec 2005 5:45 PM
Trey Walpole
We are in 2005 and [insert app code tool here] still cannot convert an
array directly to xml. *shame*


Evan Camilleri wrote:
Show quote
> We are in year 2005 and SQL still cannot receive an array as parameter!
>
> *shame*
>
>
> "Pohihihi" <pohih***@hotmail.com> wrote in message
> news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl...
>
>>How can I pass random amount of params in a SP?
>>
>
>
>

AddThis Social Bookmark Button