Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    364

    Unanswered: Using Parms with IN clause

    Is there a way to use a parm in the 'IN' of a where clause?

    Example (integerValue is an int datatype):

    declare @list as varchar(max)
    set @list = '1, 2, 3, 4'

    select *
    from table1
    where integerValue IN ( @list )

  2. #2
    Join Date
    Aug 2005
    Location
    D/FW, Texas, USA
    Posts
    78
    I've always done this with a ParseString User Defined Function. There is an example of one here: http://www.codeproject.com/database/...e_a_String.asp
    --wayne
    SELECT * FROM Users WHERE Clue>0
    0 rows returned

  3. #3
    Join Date
    May 2006
    Posts
    1
    Here is the article discussing a few solutions for your problem: http://www.sql-server-performance.co...dom_values.asp

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    and if you googled your question, that is exactly the first hit

    http://www.google.com/search?hl=en&q...here+clause%3F
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •