<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Keeping numeric format in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830531#M4861374</link>
    <description>&lt;P&gt;The server rules for converting a number to a string appear to be different than the rules used by the ISQL client to display a number.&lt;/P&gt;
&lt;PRE&gt;select (1-0.4), STRING ( (1-0.4) ), STRING ( 0.6 ), 'blabla' || (1-0.4)
 1-.4 STRING((1-.4)) STRING(.6) 'blabla' || (1-.4) 
----- -------------- ---------- ------------------ 
  0.6 .6             .6         blabla.6           
&lt;/PRE&gt;

&lt;P&gt;The first column 0.6 is not "a number converted to a string", it is "a number displayed by the ISQL client utility"&lt;/P&gt;
&lt;P&gt;The second and third columns shows numbers that were converted to strings by the SQL Anywhere server.&lt;/P&gt;
&lt;P&gt;If you want the leading zero to be included in the resulting string, you have to do that in your code... in the SELECT statement, or in your client application.&lt;/P&gt;
&lt;P&gt;For example...&lt;/P&gt;
&lt;PRE&gt;SELECT .6 AS number1,
       IF ABS ( number1 ) &amp;gt;= 1
          THEN STRING ( number1 ) 
          ELSE STRING ( 
             IF number1 &amp;lt; 0 THEN '-0' ELSE '0' ENDIF,
             STRING ( ABS ( number1 ) ) )
       ENDIF AS string1;

SELECT -.6 AS number1,
       IF ABS ( number1 ) &amp;gt;= 1
          THEN STRING ( number1 ) 
          ELSE STRING ( 
             IF number1 &amp;lt; 0 THEN '-0' ELSE '0' ENDIF,
             STRING ( ABS ( number1 ) ) )
       ENDIF AS string1;

number1 string1 
------- ------- 
    0.6 0.6     
(1 rows)


number1 string1 
------- ------- 
   -0.6 -0.6    
&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Jan 2022 09:24:45 GMT</pubDate>
    <dc:creator>Breck_Carter</dc:creator>
    <dc:date>2022-01-11T09:24:45Z</dc:date>
    <item>
      <title>Keeping numeric format</title>
      <link>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaq-p/13830530</link>
      <description>&lt;P&gt;Is it possible to keep the numerical format after concatenating with a string?&lt;/P&gt;
&lt;P&gt;In the example below the first column remains correct, in the second column I lose the zero and the decimal comma is replaced with a dot.&lt;/P&gt;
&lt;P&gt;select (1-0.4), 'blabla' || (1-0.4)&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 06:58:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaq-p/13830530</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2022-01-11T06:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping numeric format</title>
      <link>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830531#M4861374</link>
      <description>&lt;P&gt;The server rules for converting a number to a string appear to be different than the rules used by the ISQL client to display a number.&lt;/P&gt;
&lt;PRE&gt;select (1-0.4), STRING ( (1-0.4) ), STRING ( 0.6 ), 'blabla' || (1-0.4)
 1-.4 STRING((1-.4)) STRING(.6) 'blabla' || (1-.4) 
----- -------------- ---------- ------------------ 
  0.6 .6             .6         blabla.6           
&lt;/PRE&gt;

&lt;P&gt;The first column 0.6 is not "a number converted to a string", it is "a number displayed by the ISQL client utility"&lt;/P&gt;
&lt;P&gt;The second and third columns shows numbers that were converted to strings by the SQL Anywhere server.&lt;/P&gt;
&lt;P&gt;If you want the leading zero to be included in the resulting string, you have to do that in your code... in the SELECT statement, or in your client application.&lt;/P&gt;
&lt;P&gt;For example...&lt;/P&gt;
&lt;PRE&gt;SELECT .6 AS number1,
       IF ABS ( number1 ) &amp;gt;= 1
          THEN STRING ( number1 ) 
          ELSE STRING ( 
             IF number1 &amp;lt; 0 THEN '-0' ELSE '0' ENDIF,
             STRING ( ABS ( number1 ) ) )
       ENDIF AS string1;

SELECT -.6 AS number1,
       IF ABS ( number1 ) &amp;gt;= 1
          THEN STRING ( number1 ) 
          ELSE STRING ( 
             IF number1 &amp;lt; 0 THEN '-0' ELSE '0' ENDIF,
             STRING ( ABS ( number1 ) ) )
       ENDIF AS string1;

number1 string1 
------- ------- 
    0.6 0.6     
(1 rows)


number1 string1 
------- ------- 
   -0.6 -0.6    
&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jan 2022 09:24:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830531#M4861374</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2022-01-11T09:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping numeric format</title>
      <link>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830532#M4861375</link>
      <description>&lt;P&gt;Thanks Breck, I thought there is a cheaper way without own code.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 10:38:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830532#M4861375</guid>
      <dc:creator>Baron</dc:creator>
      <dc:date>2022-01-11T10:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping numeric format</title>
      <link>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830533#M4861376</link>
      <description>&lt;P&gt;Not unless SQL Anywhere will add a builtin number format function, as has been asked for often in the past.&lt;/P&gt;
&lt;P&gt;See here for a &lt;A href="https://sqlanywhere-forum.sap.com/questions/1520/how-do-i-format-numbers-in-sqla"&gt;sample function with thousand separators and decimal comma&lt;/A&gt;. FWIW there are several more samples in this forum.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 03:41:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/keeping-numeric-format/qaa-p/13830533#M4861376</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2022-01-12T03:41:51Z</dc:date>
    </item>
  </channel>
</rss>

