Re: How to pass param for IN() clause to sql command?



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.
One way would be to constuct a parametrised statement, like:
.... IN (@Param1, @Param2....
and dynamicall add all of the parameter values to Parameters
collection.
Ewww.... there's a better solution... albeit a bit of a kludge...
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



.


Loading