Re: Passing arrays to a stored procedure
From: Preeta (Preeta_at_discussions.microsoft.com)
Date: 02/02/05
- Next message: John316: "Re: programatically move to the next column"
- Previous message: Uri Dimant: "Re: help with query"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 2 Feb 2005 07:53:05 -0800
Thanks! I am aware that you can't pass an array to an sp. i was aware of that
even when i asked that question. I simply did so, because I needed to prove
this to somebody.
"louise raisbeck" wrote:
> this post was a few days ago so no idea if you will all read this but just
> read this post as need to do a similar thing. this is an open forum to help
> sql developers around the world and Joe your attitude was quite frankly rude
> and unnecessary and felt you needn't have bothered with the energy involved
> in replying.
>
> I am also writing a stored procedure and have to put an array of values into
> a stored procedure (from an asp.net drop down list). I may be wrong but I
> think that Preeta may have been asking how BEST to handle an array of values,
> not how to declare an array in a stored procedure, which of course you cant
> do. Preeta I have found that the best way to do this really is to pass a CSV
> (comma delimited) list of values into a variable of nvarchar then split out
> the values in the stored procedure.
>
> Or you could do what Joe suggested and go learn how to think and write
> proper sql code and dont ask a question until you do just that!!!!
>
> regards,
>
> "Joe Celko" wrote:
>
> > >> Can you pass arrays to a stored procedure? if so, how? Please
> > explain. <<
> >
> > You reallllllly need to get a book on the basics before you try to
> > program in the language.
> >
> > SQL uses tables as its only data structure and it holds only scalar
> > (atomic) values. There are no arrays in the language. Parameters are
> > scalars. You will need to break the the host language array elements
> > into scalars.
> >
> > There are several kludges for this kind of bad programming available in
> > FAQ. However, the right answer is to learn to think and write proper
> > SQL code instead of trying to force your old mental model of data into
> > SQL.
> >
> > --CELKO--
> > Please post DDL, so that people do not have to guess what the keys,
> > constraints, Declarative Referential Integrity, datatypes, etc. in your
> > schema are. Sample data is also a good idea, along with clear
> > specifications.
> >
> >
> > *** Sent via Developersdex http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it!
> >
- Next message: John316: "Re: programatically move to the next column"
- Previous message: Uri Dimant: "Re: help with query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|