title: Converting Varchar Value to Integer/Decimal Value in SQL Server
body: <p>How to convert the value of records in a table with data type <code>varchar</code> to <code>integer</code> or <code>decimal</code> so I can get the sum of the value. I use <code>SQL Server 2005</code>.</p>
  
  <p>Say that I have table structure like this:</p>
  
  <pre><code>ID int
  Stuff varchar
  </code></pre>
  
  <p>and the records</p>
  
  <pre><code>ID = 1, Stuff = 32.43
  ID = 2, Stuff = 43.33
  ID = 3, Stuff = 23.22
  </code></pre>
  
  <p>Now I want to get the total of column Stuff:</p>
  
  <pre><code>SELECT SUM(convert(decimal(4,2), Stuff)) as result FROM table
  </code></pre>
  
  <p>But it doesn't work. Please need help!</p>