|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
random numbers of paramThis 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? > 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? >> > > "Pohihihi" <pohih***@hotmail.com> wrote in message A stored parameter can have upto 2100 parameters according to BOL and they news:OpnMgEs9FHA.3208@TK2MSFTNGP11.phx.gbl... > How can I pass random amount of params in a SP? > 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 -- 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 > -- > > 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? > 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? >> > > 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? > 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* > "Evan Camilleri" <e7***@yahoo.co.uk.nospam> wrote in message Erland explains it so well:news:uZelkOz9FHA.3608@TK2MSFTNGP09.phx.gbl... > We are in year 2005 and SQL still cannot receive an array as parameter! > > *shame* ....T-SQL does have arrays. They are called tables. >> ...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 "Anith Sen" <an***@bizdatasolutions.com> wrote in message Yeah I know. Arrays <> Tables <> XMLnews: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 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. 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? >> > > > |
|||||||||||||||||||||||