title: TSQL If Statement
body: <p>I have a script where I am allowing for a user to generate a report. They choose options and one of those drop downs is Location. It contains a list of places and the very first option is "ALL". </p>
  
  <p>When you select all, I would like to have it include anything thats in the location column.</p>
  
  <p>Here is my current statement.</p>
  
  <pre><code>IF (@action = 'searchActivityLog')
          IF (@type = 'actor')
              BEGIN
                  SELECT  actor,
                          action,
                          CONVERT (VARCHAR (20), timestamp, 100) AS timestamp,
                          [key],
                          location
                  FROM   Keys_Log
                  WHERE  actor = @data AND location = @location
                  ORDER BY timestamp asc
                  FOR    XML PATH ('results'), TYPE, ELEMENTS, ROOT ('root');
              END
          ELSE
  </code></pre>
  
  <p>Is there a way to basically say if Location = All then dont even include that in the where clause?</p>