<?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>topic Warning to developers:   SQL Anywhere and numeric datawindow bind variables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/warning-to-developers-sql-anywhere-and-numeric-datawindow-bind-variables/m-p/439009#M12878</link>
    <description>&lt;P&gt;I have been working with SAP SQL Anywhere support group to pin down why a simple SQL statement was not using the primary key index and is doing a full table scan.  The primary key of the table is numeric(20,0).   The datawindow sql statement is of the form select * from table where key=:an_key  - where :an_key is declared as a numeric argument.  If I create the same datawindow but the value passed in is a string then the index is used.   After much going back and forth we have determined that the issue is that PowerBuilder passes in a numeric argument as a double.  A double is considered by SQL Anywhere to be an approximate datatype.  If I have a primary key that is numeric(20,0) then it will not use the primary index and will do a table scan whereas if the primary key is an integer then it will use the primary key!   This seems to affect all versions of Sybase SQL Anywhere.  I have reproduced this in PB6.5 and PB12.5&lt;/P&gt;</description>
    <pubDate>Thu, 18 May 2017 16:40:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2017-05-18T16:40:37Z</dc:date>
    <item>
      <title>Warning to developers:   SQL Anywhere and numeric datawindow bind variables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/warning-to-developers-sql-anywhere-and-numeric-datawindow-bind-variables/m-p/439009#M12878</link>
      <description>&lt;P&gt;I have been working with SAP SQL Anywhere support group to pin down why a simple SQL statement was not using the primary key index and is doing a full table scan.  The primary key of the table is numeric(20,0).   The datawindow sql statement is of the form select * from table where key=:an_key  - where :an_key is declared as a numeric argument.  If I create the same datawindow but the value passed in is a string then the index is used.   After much going back and forth we have determined that the issue is that PowerBuilder passes in a numeric argument as a double.  A double is considered by SQL Anywhere to be an approximate datatype.  If I have a primary key that is numeric(20,0) then it will not use the primary index and will do a table scan whereas if the primary key is an integer then it will use the primary key!   This seems to affect all versions of Sybase SQL Anywhere.  I have reproduced this in PB6.5 and PB12.5&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 16:40:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/warning-to-developers-sql-anywhere-and-numeric-datawindow-bind-variables/m-p/439009#M12878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-18T16:40:37Z</dc:date>
    </item>
  </channel>
</rss>

