SQL Server Performance

dynamically using a where condition!

Discussion in 'SQL Server 2005 General Developer Questions' started by shankbond, Nov 2, 2009.

  1. shankbond New Member

    Hi,
    I have a typical problem here ,I am designing a stored procedure this stored procedure takes parameter say location, these parameter will be passed from front end by the user itself; consider:
    location can be CA, OH , NJ, NY, WA etc.(there can be n-number of locations sent by the user)
    Now I have a table with n-number of user records each residing in different location.
    so basically I have to perform A seach in this table .
    SELECT * FROM table1 WHERE location= ?
    As I said the number of locations sent by the user is not known( dynamic) ,so how should I implement the where condition?
    Any help shall be appreciated
  2. FrankKalis Moderator

    You could have a Split function that returns a table and then use that function to JOIN onto table1.
  3. Madhivanan Moderator

  4. shankbond New Member

    Thanks guys it really helped
    So problem resolved :)

Share This Page