title: T-SQL Conditional Query
body: <p>Is there difference in performance when querying someting like this?</p>
  
  <p>Query 1:</p>
  
  <pre><code>SELECT * FROM Customer WHERE Name=Name
  </code></pre>
  
  <p>Query 2:</p>
  
  <pre><code>SELECT * FROM Customer
  </code></pre>
  
  <p>I will use it in conditional select all</p>
  
  <pre><code>SELECT * FROM Customer 
  WHERE Name = CASE WHEN @QueryAll='true' THEN Name ELSE @SearchValue END
  </code></pre>
  
  <p>If there's no performance issue in Query 1 and 2, I think it is a short code for this one:</p>
  
  <pre><code>IF @QueryAll='true'
      SELECT * FROM Customer
  ELSE
      SELECT * FROM Customer WHERE Name=@SearchValue
  </code></pre>