RE: Variabel parameter for IN-clause in SP
anonymous_at_discussions.microsoft.com
Date: 12/15/04
- Next message: David Gugick: "Re: How can I assign the result of dateadd to a variable ?"
- Previous message: anonymous_at_discussions.microsoft.com: "RE: Variabel parameter for IN-clause in SP"
- In reply to: Alejandro Mesa: "RE: Variabel parameter for IN-clause in SP"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Dec 2004 13:02:25 -0800
Thanks for your help. It solved my problem
Eje
>-----Original Message-----
>Arrays and Lists in SQL Server
>http://www.sommarskog.se/arrays-in-sql.html
>
>
>
>AMB
>
>"Eje" wrote:
>
>> I need stored procedures with basically the following
>> content:
>> select * from mytable where id in(1,2,3)
>> or
>> select * from mytable where name in(a,b,c,d)
>>
>> I want to supply 1,2,3/a,b,c,d via parameter to the
sp.
>> The number of values can vary widely as can the values
of
>> the values.
>>
>> I suppose I could create a table with the values and
use
>> a select string inside the IN-clause but is there a
more
>> direct way where I can supply the values via
parameters?
>>
>> I can't write "exec mysp 1,2,3" because that is
handled
>> as three separate parameters and I can't write "exec
>> mysp '1,2,3'" because even if the sp is inteligent
enough
>> to see that id is a number it tries to convert '1,2,3'
to
>> ONE column or number. I get basically the same problem
if
>> I have strings (name and a,b,c,d).
>>
>> Is there a smart way?
>>
>> Eje
>>
>.
>
- Next message: David Gugick: "Re: How can I assign the result of dateadd to a variable ?"
- Previous message: anonymous_at_discussions.microsoft.com: "RE: Variabel parameter for IN-clause in SP"
- In reply to: Alejandro Mesa: "RE: Variabel parameter for IN-clause in SP"
- Messages sorted by: [ date ] [ thread ]