title: Sybase convert issue from float to varchar
body: <p>First, I need to mention that my current sybase db version is <strong>Adaptive Server Enterprise 12.5.4</strong>. I aim to convert float data type into <code>varchar</code> via sybase convert function in order to <code>concat</code> several of these kinds of variables, format and store in string type.</p>
  
  <p>Unfortunately, it is not the case. Simply using <code>convert(varchar(20), float_var)</code> or <code>cast()</code> function cannot correctly return the precise value. </p>
  
  <p>For example, ...</p>
  
  <pre><code>declare @float_var float
  begin
      select @float_var =345.1237    --from table actually
      select convert(varchar(20),@float_var)     --return 345.1236999999
  end
  </code></pre>
  
  <p>The incorrect string results returned occasionally have <code>99999</code> or <code>00001</code> suffix. </p>
  
  <p>I tried many function including specify the precision, but there are still several cases not working on it. The sybase internal function does not exactly work on it. </p>
  
  <p>I suppose this is a gerneral issue while using Sybase DB, however few answer found in serach. During my past experience, Sybase store procedure gammer always has sort of tolerance in runtime and internal fix when error encounter. This issue make me confused how Sybase works internally. Any advice would be appreciated, thanks in advance.</p>