title: How do I sort a VARCHAR column in SQL server that contains numbers?
body: <p>I have a <code>VARCHAR</code> column in a <code>SQL Server 2000</code> database that can contain either letters or numbers. It depends on how the application is configured on the front-end for the customer. </p>
  
  <p>When it does contain numbers, I want it to be sorted numerically, e.g. as "1", "2", "10" instead of "1", "10", "2". Fields containing just letters, or letters and numbers (such as 'A1') can be sorted alphabetically as normal. For example, this would be an acceptable sort order.</p>
  
  <pre><code>1
  2
  10
  A
  B
  B1
  </code></pre>
  
  <p>What is the best way to achieve this? </p>