Re: How to pass param for IN() clause to sql command?
- From: Andrew Backer <awbacker@xxxxxxxxx>
- Date: Tue, 15 Jan 2008 17:58:40 +0000 (UTC)
I've noticed that too. It seems like some of these issues are so preditcable that it's surprising they didn't include them. Sometimes it's as if they didn't use their own product, especially with some other ones. I can understand this issue a bit, and how it might be difficult to say exactly what this means, but stil... we have 100 other datatypes with custom handling, why not one more =)
// Andrew
Yep, there are other ways as well.
But what I can't understand is why MS (and other database vendors as
well)
don't provide a more friendly mechanism of passing arrays around, like
passing a normal parameter.
Afterall this requirement isn't something exotic - it is something
that we
code every day again and again.
"Chris Anderson [MVP-VB]" <tg-nospam@tannagh-dawt-com> wrote in
message news:%23lv8GR1VIHA.1212@xxxxxxxxxxxxxxxxxxxxxxx
Miha Markic wrote:
Yep, that's an achiles heel of parameters passing.Ewww.... there's a better solution... albeit a bit of a kludge...
One way would be to constuct a parametrised statement, like:
.... IN (@Param1, @Param2....
and dynamicall add all of the parameter values to Parameters
collection.
What we've done to overcome this problem is to ensure the data is
delimited somehow (pipes or comas), then loop through the string,
extracting each one, and putting it into a temp table (or a table
variable). Then we use that as the IN clause.
-ca
.
- References:
- Re: How to pass param for IN() clause to sql command?
- From: Miha Markic
- Re: How to pass param for IN() clause to sql command?
- Prev by Date: Re: LINQ to ADO.NET Intellisense Question (VB9)
- Next by Date: RE: How to pass param for IN() clause to sql command?
- Previous by thread: Re: How to pass param for IN() clause to sql command?
- Next by thread: RE: How to pass param for IN() clause to sql command?
- Index(es):
Loading