Passing a where clause to an SP

  •  

    Hi All

     

    I'm writing a SP that will search all columns in a table. The search criteria will vary a lot (sometimes an exact case-sensitive match is required, sometime I want to use a like clause and sometimes an in clause), so I want to be able to pass the where clause as a parameter. Fro example:

    EXEC FindAll " like '%ABC%' "

    EXEC FindAll " in ('ABC', 'DEF', 'GHI') "

    EXEC FindAll "= 'ABC' "

    Can soemone give me a hint of how I can escape the quotes, commas, etc.?

    I'm using SQl Server 2005

    Thanks

    Mark

  • http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm

    You can also load the list into a @temptable and join to it when building your @SQLCommand

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply