title: sql cast hour out of datetime without dropping leading zero on single digit hours
body: <pre><code>CAST(DATEPART(hh, timestamp) AS varchar(2)) + ':00' AS Hour
  </code></pre>
  
  <p>This will get me the hour out of a timestamp field but in the case of the hours 0-9 it does not pad a leading zero and therefore when I sort by hour descending it does not sort correctly.</p>
  
  <p>Not sure what is wrong here. I specify a 2 char varchar to allow extra room for the leading zero. Hopefully there is a way to fix this without passing my field through a function that will pad the leading zero for me.</p>