List:General Discussion« Previous MessageNext Message »
From:Arthur Fuller Date:March 29 2009 12:13pm
Subject:Re: Search based where claused and stored proc
View as plain text  
An approach that has worked for me in the past and may work for you. Declare
as many parms as you can possibly need and then code the statement like
this:

<sql>
SELECT * FROM someWhere
WHERE @parm1 = 123 OR @parm1 IS NULL
AND @parm2 = 345 OR @parm2 IS NULL
-- etc.

This has the desired effect and eliminates the need for a temp table or
actual table (inno or otherwise). The trick here is to pass the maximum
number of parms, even if they are Nulls.

HTH,
Arthur

Thread
Search based where claused and stored procGary Smith27 Mar
  • RE: Search based where claused and stored procBen Wiechman27 Mar
    • RE: Search based where claused and stored procMartin Gainty27 Mar
      • RE: Search based where claused and stored procGary Smith27 Mar
        • Re: Search based where claused and stored procArthur Fuller29 Mar