title: Use a named custom column in SQL 2005 in WHERE clause?
body: <p>Can I name a custom column in the SELECT statement and reference that in the WHERE clause without duplicating code?</p>
  
  <p>For example;</p>
  
  <pre><code>SELECT RIGHT(REPLICATE('0', 5) + RTRIM(SOME_ID)), 5) AS DISPLAY_ID
  FROM dbo.MY_TABLE
  WHERE DISPLAY_ID LIKE '%005%'
  </code></pre>
  
  <p>Only much more complicated. I want to maintain this code in one place only but SQL Server 2005 forces me to duplicate the custom SELECT in the WHERE clause.</p>
  
  <p>I believe this was possible in Microsoft SQL Server 2000 but no longer in 2005.</p>
  
  <p>Thanks.</p>