title: How to Handle Multi Currencies (Precision and Scale) from one Column in SQL Query
body: <p>I have a three columns in table</p>
  
  <pre><code>TransactionDate---DateTime
  TotalAmount---DECIMAL(18,4)
  CurrencyCode---nVarchar(10)
  
  TotalAmount-------------CurrencyCode
  1000.5000----------------KD (Kuwaiti Dinnar) which must be 1000.500
  5500.2000----------------ETB (Eithopian Birr)
  2500.1500----------------USD (United States Dollars) which must be 2500.15
  </code></pre>
  
  <p>I am storing these multi currencies in one column......now i want to get report for each day or month by using SUM() Function in SQL Query.............but SUM must be done based on each currency's precision or scale.
  i.e.....If currency is USD   then </p>
  
  <pre><code>SUM(2500.15)
  </code></pre>
  
  <p>If currency is KD then </p>
  
  <pre><code>SUM(1000.500)
  </code></pre>
  
  <p>and If ETB then </p>
  
  <pre><code>SUM(5500.2000)
  </code></pre>
  
  <p>some thing like this..</p>