title: Precision of decimal computed columns in T-SQL
body: <p>We used to have the following field in database:</p>
  
  <pre><code>FieldA    decimal(19, 2)
  </code></pre>
  
  <p>We have changed the field to a computed field:</p>
  
  <pre><code>ALTER TABLE MyTable
  ADD FieldA AS FieldB * FieldC
  </code></pre>
  
  <p>Where:</p>
  
  <pre><code>FieldB    decimal(19, 2)
  FieldC    decimal(19, 5)
  </code></pre>
  
  <p>The resulting new <code>FieldA</code>:</p>
  
  <pre><code>FieldA    (Computed, decimal(38,6))
  </code></pre>
  
  <p>The legacy code uses <code>FieldA</code>with the assumption that it has two decimals. Thus, the string translations do not apply formatting. As a result, with the new definition, <code>FieldA</code> is shown with six decimals, which is unacceptable.</p>
  
  <p>Is it possible to modify the precision of the computed column (say, to keep the original type <code>decimal(19, 2)</code>) or do we need to add appropriate formatting to all the places that are displaying the value?</p>
  
  <p>Rounding does not work:</p>
  
  <pre><code>ADD FieldA AS ROUND(FieldB * FieldC, 2)
  </code></pre>