Re: Passing in a Parameter
- From: Kunkel <dankunkel@xxxxxxxxxxx>
- Date: Thu, 28 Apr 2005 15:30:02 -0700
thanks for that link! it was very helpful. but after i implemented the
articles ideas, i came across this solution:
DECLARE @Var AS VARCHAR(100)
SET @Var = '''Dan'', ''Mike'', ''Lisa'''
DECLARE @SQL AS varchar(1000)
SET @SQL = 'SELECT *
FROM ORDERS
WHERE
NAME IN (' + @Var + ')'
Exec(@SQL)
"Hugo Kornelis" wrote:
> On Thu, 28 Apr 2005 08:04:09 -0700, Kunkel wrote:
>
> >Hi All,
> >
> >I have a Stored Proc and would like to pass in a VARCHAR parameter. The
> >problem is that the query will need to use it in a IN clause...
> >
> >DECLARE @PARAM AS VARCHAR(20)
> >SET @PARAM = 'Dan', 'Mike', 'Lisa'
> >
> >SELECT *
> >FROM Orders
> >WHERE Name IN (@PARAM)
> >
> >is there a away around this?
>
> Hi Kunkel,
>
> Several. And they are all described and compared at
> http://www.sommarskog.se/arrays-in-sql.html
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
.
- Follow-Ups:
- Re: Passing in a Parameter
- From: Hugo Kornelis
- Re: Passing in a Parameter
- References:
- Passing in a Parameter
- From: Kunkel
- Re: Passing in a Parameter
- From: Hugo Kornelis
- Passing in a Parameter
- Prev by Date: Re: Passing in a Parameter
- Next by Date: Re: Passing in a Parameter
- Previous by thread: Re: Passing in a Parameter
- Next by thread: Re: Passing in a Parameter
- Index(es):
Relevant Pages
|
|