<?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 Re: count function does not support by Teradata ODBC engine for SAS/Access in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690354#M210026</link>
    <description>&lt;P&gt;Thanks ChrisNZ. Actually in my production code, I do have cast(variable1 as int) as variable1, cast(variable2 as char(5)) as variable2, etc. The inventory variable does have datatype that SAS supports. The issue appears to have something to do with the count function because no matter what variable I put inside the count function, i am getting the same error message.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Oct 2020 12:49:10 GMT</pubDate>
    <dc:creator>LL5</dc:creator>
    <dc:date>2020-10-09T12:49:10Z</dc:date>
    <item>
      <title>count function does not support by Teradata ODBC engine for SAS/Access</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/689975#M209814</link>
      <description>&lt;P&gt;Hi all, I am trying to run a sql pass thru query with ODBC connection to Teradata but it seems the count function is not supported by this engine. I tried a different approach by removing the count function outside of the pass thru query and it ran well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find out 1) Is there a better/alternative way to accomplish the same goal and 2) why count function is not supported by the odbc engine?&lt;/P&gt;&lt;P&gt;Below are the codes and error message for both approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Approach 1 - this gives me error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CONNECT TO teradata(user=&amp;amp;tduid password=&amp;amp;tdpwd server=axb connection=global mode=teradata fastload=yes fastexport=yes);
  CREATE TABLE inventory AS
    SELECT * 
      FROM CONNECTION TO teradata
        ( SELECT  
          count(inventory) as inv_count, 
          region                                   

        FROM      warehouse.inventory                                                                                                                      
          WHERE sale_date = '2020-10-01'                                                     

          GROUP BY region
        );
ERROR: At least one of the columns in this DBMS table has a datatype that is not supported by this engine.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Approach 2- this works but I wonder a better/alternative way because in reality, I have a lot more fields and tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CONNECT TO teradata(user=&amp;amp;tduid password=&amp;amp;tdpwd server=axb connection=global mode=teradata fastload=yes fastexport=yes);
  CREATE TABLE inventory AS
    SELECT count(inventory) as inv_count, 
      region
    FROM CONNECTION TO teradata
      ( SELECT        &lt;BR /&gt;        inventory,                                               
        region                                                           
      FROM      warehouse.inventory                                                                                                                      
        WHERE sale_date = '2020-10-01'    
      )  GROUP BY region;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table work.inventory created, with 131 rows and 15 columns.&lt;BR /&gt;NOTE:&amp;nbsp;Teradata&amp;nbsp;connection:&amp;nbsp;TPT&amp;nbsp;FastExport&amp;nbsp;has&amp;nbsp;read&amp;nbsp;38112&amp;nbsp;row(s).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 13:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/689975#M209814</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-10-08T13:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: count function does not support by Teradata ODBC engine for SAS/Access</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690222#M209967</link>
      <description>&lt;LI-CODE lang="sas"&gt;ERROR: At least one of the columns in this DBMS table has a datatype that is not supported by this engine.&lt;/LI-CODE&gt;
&lt;P&gt;This tells me that variable INV_COUNT should probably be created as a datatype that SAS supports.&lt;/P&gt;
&lt;P&gt;See &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=acreldb&amp;amp;docsetTarget=n0v7nh4ylrihtin1te8xl0q3dvzv.htm&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 22:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690222#M209967</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-10-08T22:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: count function does not support by Teradata ODBC engine for SAS/Access</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690354#M210026</link>
      <description>&lt;P&gt;Thanks ChrisNZ. Actually in my production code, I do have cast(variable1 as int) as variable1, cast(variable2 as char(5)) as variable2, etc. The inventory variable does have datatype that SAS supports. The issue appears to have something to do with the count function because no matter what variable I put inside the count function, i am getting the same error message.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 12:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690354#M210026</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-10-09T12:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: count function does not support by Teradata ODBC engine for SAS/Access</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690356#M210027</link>
      <description>&lt;P&gt;Do a CAST to INT for the result of the COUNT function.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 12:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690356#M210027</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-09T12:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: count function does not support by Teradata ODBC engine for SAS/Access</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690361#M210029</link>
      <description>&lt;P&gt;This works. Since Inventory is a character field, I did not even though about casting it to INT for the count function.&lt;/P&gt;&lt;P&gt;Thanks a lot for this great tip.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CAST(COUNT(INVENTORY) AS INT) AS INV_COUNT&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Oct 2020 13:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-function-does-not-support-by-Teradata-ODBC-engine-for-SAS/m-p/690361#M210029</guid>
      <dc:creator>LL5</dc:creator>
      <dc:date>2020-10-09T13:19:41Z</dc:date>
    </item>
  </channel>
</rss>

