title: How to convert SQL column null value to 0 and varchar to decimal in sql query
body: <p>I need to convert a SQL column which is in <code>varchar</code> datatype to <code>decimal</code> and the null values to 0. This is my code to convert <code>varchar</code> to <code>decimal</code>:</p>
  
  <pre><code>SELECT 
      CAST(debit as DECIMAL(9,2)),
      CAST(credit as DECIMAL(9,2)),
      sum_accname,
      sum_date, 
      sum_description
  FROM 
      sum_balance
  </code></pre>
  
  <p>I need to convert debit and credit column null values to zero. How to insert the null value converting part to this code?</p>