title: Optional Arguments in WHERE Clause
body: <p>Lets suppose there is a stored procedure that has 3 params. Out of all the possibilities, I'm looking to achieve this with a single <code>WHERE</code> clause without getting out of control with using <code>() AND () OR ()</code> too much...</p>
  
  <p>Example:</p>
  
  <pre><code>    //Params
  @CITY VARCHAR(100) = NULL,
  @GENDER VARCHAR(100) = NULL,
  @AGE VARCHAR(100) = NULL
  </code></pre>
  
  <p>I suppose you can do it using <code>IF BEGIN ... END</code> for each Variable if Exists, but that makes the code alot longer than desired.. </p>
  
  <p>This method below won't work because its way too long (there are about 10 different fields like this, but the example is only 3.) and i'm not sure if it even directly pulls up distinctive values...</p>
  
  <pre><code>SELECT NAME FROM TABLE 
  WHERE (
  (CITY=@CITY AND GENDER=@GENDER AND AGE=@AGE)
  OR (CITY=@CITY AND GENDER=@GENDER)
  OR (GENDER=@GENDER AND AGE=@AGE)
  OR (CITY=@CITY AND AGE=@AGE)
  OR (CITY=@CITY)
  OR (GENDER=@GENDER)
  OR (AGE=@AGE)
  )
  </code></pre>
  
  <p>Is there an even shorter more efficient way to do this?</p>
  
  <p>If yes, it is preferable for the method to be compatible with JOIN's also.</p>