title: Converting a datetime to a numeric representation
body: <p>I want to convert a datetime field into a numeric representation in form of YYYYMMDD. So, my logic here is (from 2011-01-01 12:00:00.000 to 20110101) :</p>
  
  <pre><code>convert(int, replace(cast(getdate() as date), '-', ''))
  </code></pre>
  
  <p>According to MSDN ( <a href="http://msdn.microsoft.com/en-us/library/bb630352.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb630352.aspx</a> ), the string representation is [always?] "YYYY-MM-DD", so I simply convert that string to an INT after removing dashes from the string.</p>
  
  <p>Will this always works? Will I encounter some problems with that? Is there a better way to achieve this?</p>
  
  <p>Thanks</p>