title: Converting double to numeric - Sybase
body: <p>I have a column with type double precision and I'd like copy values from this column to another column with type numeric(19,2).</p>
  
  <p>When I do <code>select CONVERT( numeric(19,2), PriceNettoTmp) from Table</code> it works but when I do <code>update Table set PriceNetto = CONVERT( numeric(19,2), PriceNettoTmp)</code> it doesn't.</p>
  
  <p>Error message for <code>update</code> when executing in Squirrel SQL:</p>
  
  <blockquote>
    <p>Data Truncation error occured on a write  of column -1Data was -1
    bytes long and -1 bytes were transferred.</p>
  </blockquote>
  
  <p>Error message for <code>update</code> when executing in Sybase Central:</p>
  
  <blockquote>
    <p>Could not execute statement. Arithmetic overflow during explicit
    conversion of FLOAT NULL value '10,449999999999999.0' to a NUMERIC
    field . Sybase error code=247 Severity Level=16, State=1, Transaction
    State=0 Line 1</p>
  </blockquote>
  
  <p>Anybody knows what can be wrong?</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>I found a solution which works: <code>update Table set PriceNetto = CONVERT( numeric(19,2), str_replace(str(PriceNettoTmp,19,2),',','.'))</code></p>
  
  <p>Although I still don't understand why <code>select</code> was working and <code>update</code> not. And is there any simpler solution than my?</p>