Re: IN Operator in SQL queries with a variable having comma seperated values

From: Aaron Bertrand - MVP (aaron_at_TRASHaspfaq.com)
Date: 05/21/04


Date: Fri, 21 May 2004 13:49:54 -0400

http://www.aspfaq.com/2248

-- 
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Rose" <myfrnds4evr@yahoo.com> wrote in message
news:104d801c43f4f$54f9a670$a101280a@phx.gbl...
> Hi
>
> Consider the following situation...
> Following is my procedure:
>
> create  procedure  ret_dep_values  @dept_type varchar(255)
> as
> begin
> select dept_cde, dept_name, dept_type
> from dept
> where dept_type in  ( @dept_type  )
> end
>
> The Argument i will be passing for execution is :
>
> Exec  ret_dep_values "Finance','Marketing"
>
>
> Can such a code workout
> This needs to retrieve all the dept valued based on the
> types passed using IN Operator dynamically...
> i am currently not retrievinng any results ...
> any suggessions to this...
> Thanks & Regds
> Rose
>
>


Relevant Pages

  • Re: IN Operator in SQL queries with a variable having comma seperated values
    ... - use dynamic SQL to compose the entire query, ... "Rose" wrote in news:104d801c43f4f$54f9a670 ... > This needs to retrieve all the dept valued based on the ...
    (microsoft.public.sqlserver.programming)
  • Re: sa Password
    ... Check out the section in BOL under "passwords, ... Andrew J. Kelly ... SQL Server MVP ... "Rose" wrote in message ...
    (microsoft.public.sqlserver.security)