title: SQL query returning null?
body: <p>When I run this query, it returns null value for ID. The code is supposed to get the max value in the id column. </p>
  
  <pre><code>2013-06-13-0001
  2013-06-13-0002
  </code></pre>
  
  <p>It should get the <code>2013-06-13-0002</code> (because of the <code>0002</code> being a greater value than the <code>0001</code>) for the id column.. the query is supposed to get the max id and add 1 to it.</p>
  
  <pre><code>SELECT 
     ID = LEFT(max(ID), 10) + '-' + 
          RIGHT('000' + CONVERT(VARCHAR, CONVERT(INT, RIGHT(max(ID), 4)) + 1), 4)
  FROM John_IEP_Crossing_Dock_Shipment
  WHERE
     LEFT(ID, 10) = CONVERT(VARCHAR(10), Getdate(), 20) 
  </code></pre>