title: Most Performant Way to Convert DateTime to Int Format
body: <p>I need to convert Datetime fields to a specifically formatted INT type. For example, I want 
   <code>2000-01-01 00:00:00.000</code> to convert to <code>20010101</code>.</p>
  
  <p>What is the most performant way to make that conversion for comparison in a query? </p>
  
  <p>Something like: </p>
  
  <pre><code>DATEPART(year, orderdate) * 10000 + DATEPART(month, orderdate) * 100 + 
      DATEPART(day, orderdate)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>cast(convert(char(8), orderdate, 112) as int) 
  </code></pre>
  
  <p>What's the most performant way to do this? </p>