<?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: Cannot convert to a numeric  SQLA16 in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834423#M4865266</link>
    <description>&lt;P&gt;What is the exact select statement containing the column?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2023 03:37:33 GMT</pubDate>
    <dc:creator>fvestjens</dc:creator>
    <dc:date>2023-03-20T03:37:33Z</dc:date>
    <item>
      <title>Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaq-p/13834422</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a column char(15), with the data 2304981100F1&lt;/P&gt;
&lt;P&gt;if I call a select, that show below error..  how can I fix it ?&lt;/P&gt;
&lt;P&gt;[&lt;CODE&gt;Sybase][ODBC Driver][SQL Anywhere]Cannot convert '2304981100F1' to a numeric&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;tks.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Mar 2023 21:42:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaq-p/13834422</guid>
      <dc:creator>former_SQLA_member1694965</dc:creator>
      <dc:date>2023-03-19T21:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834423#M4865266</link>
      <description>&lt;P&gt;What is the exact select statement containing the column?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 03:37:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834423#M4865266</guid>
      <dc:creator>fvestjens</dc:creator>
      <dc:date>2023-03-20T03:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834426#M4865269</link>
      <description>&lt;P&gt;Have you read this article?
&lt;A href="https://help.sap.com/docs/SAP_SQL_Anywhere/93079d4ba8e44920ae63ffb4def91f5b/81733f956ce21014970ff897ff8fbebf.html"&gt;https://help.sap.com/docs/SAP_SQL_Anywhere/93079d4ba8e44920ae63ffb4def91f5b/81733f956ce21014970ff897ff8fbebf.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Sounds that your number is two digits bigger than a 32-bit integer.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 07:45:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834426#M4865269</guid>
      <dc:creator>Vlad</dc:creator>
      <dc:date>2023-03-20T07:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834427#M4865270</link>
      <description>&lt;P&gt;More details on what you are trying to do will be very helpful here.&lt;/P&gt;
&lt;P&gt;THe SQL below cause no issues when executed via DBISQL.&lt;/P&gt;
&lt;PRE&gt;create table t1 ( c1 char(15) );
insert into t1(c1) values ('2304981100F1');
select c1 from t1;
&lt;/PRE&gt;

&lt;P&gt;The existence of the letter 'F' in your string means it's not a numeric value, so I can see the same error you are seeing if I try to cast it to a numeric.&lt;/P&gt;
&lt;PRE&gt;select cast (c1 as numeric(100,50)) from t1
&lt;/PRE&gt;

&lt;P&gt;Are you trying convert a string representation of a number in base-16 to base-10?  &lt;/P&gt;
&lt;P&gt;Reg&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 09:50:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834427#M4865270</guid>
      <dc:creator>regdomaratzki</dc:creator>
      <dc:date>2023-03-20T09:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834428#M4865271</link>
      <description>&lt;P&gt;If this working fine for you then it must be a database option that prevents the error.
The string contains an 'F' and in my setup of SQL Anywhere version 17 build 7236 it also fails.&lt;/P&gt;
&lt;PRE&gt;There was an error reading the results of the SQL statement.
The displayed results may be incorrect or incomplete.
Cannot convert '2304981100F1' to numeric
SQLCODE=-157, ODBC 3 State="07006"
Line 1, column 1

select cast ('2304981100F1' as numeric(100,50))
&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2023 11:38:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834428#M4865271</guid>
      <dc:creator>fvestjens</dc:creator>
      <dc:date>2023-03-20T11:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834424#M4865267</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I was selecting a trigger with 2 tables and that is why this error is occurring. Even though in both tables, the columns are char (15), the error persists. Anyway, thank you for your help and I will look for a solution without having to use the letter "F" mixed with numbers.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 21:02:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834424#M4865267</guid>
      <dc:creator>former_SQLA_member1694965</dc:creator>
      <dc:date>2023-03-20T21:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834429#M4865272</link>
      <description>&lt;P&gt;You should not need to make a change to the data - IMO it would only be masking an implementation problem. Something is manipulating that value not as a character type. Perhaps a flaw in the trigger logic, a computed column, or a check constraint, to name a few possibilities that may explain this.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 23:24:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834429#M4865272</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2023-03-20T23:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot convert to a numeric  SQLA16</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834425#M4865268</link>
      <description>&lt;P&gt;As others have asked, what exactly is your SELECT statement? Are you comparing the CHAR values to numeric values? If so, this will lead to trying to cast the CHAR to a numeric value and will fail because the "F" is not allowed for any numeric type. (See &lt;A href="https://dcx.sap.com/index.html#sqla170/en/html/81f5b3726ce210149a86daae0ce64be4.html"&gt;here for details on mixted-type comparisons&lt;/A&gt;...&lt;/P&gt;
&lt;P&gt;The following first two queries will raise this error, as the comparison value is provided as int resp. numeric - whereas the third will succeed because the comparison is done with string semantics (and returns an empy result set, as expected):&lt;/P&gt;
&lt;PRE&gt;select cast('2304981100F1' as char(15)) as MyValue where MyValue = 1;
select cast('2304981100F1' as char(15)) as MyValue where MyValue = 1.1;
select cast('2304981100F1' as char(15)) as MyValue where MyValue = '1';
&lt;/PRE&gt;

&lt;P&gt;So I suspect there is a comparison in your query that attempts to compare your CHAR(15) column with a numeric column or literal.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 03:50:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-convert-to-a-numeric-sqla16/qaa-p/13834425#M4865268</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2023-03-21T03:50:09Z</dc:date>
    </item>
  </channel>
</rss>

