<?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: SQL Passthrough creates character vars of length 32767 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745156#M233542</link>
    <description>&lt;P&gt;Thanks that is a good direction to question.&amp;nbsp; The SQL column is varchar(max).&amp;nbsp; It is used to store multiple types of data with an associated key field.&amp;nbsp; It looks like the field that is being returned was created as an integer when it should have been a character field of length 10.&amp;nbsp; Instead it was stored as an integer hence the max length standard integer being returned.&amp;nbsp; Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 12:09:49 GMT</pubDate>
    <dc:creator>jlh368</dc:creator>
    <dc:date>2021-06-02T12:09:49Z</dc:date>
    <item>
      <title>SQL Passthrough creates character vars of length 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745042#M233499</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Support on an external server for the SQL driver ended.&amp;nbsp; We are using in our ODBC connection with the driver SQL Server.&amp;nbsp; We recreated the connection with ODBC Driver 17 for SQL Server. This reestablished our connection but the data returned for some character vars is returned at a length of 32767.&amp;nbsp; I can cast the vars in the pass thru to get smaller numbers cast(var as varchar(9)) as var_name1.&amp;nbsp; This seems like an extra step.&amp;nbsp; What am I missing? Should I use the SAS/Access driver?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 20:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745042#M233499</guid>
      <dc:creator>jlh368</dc:creator>
      <dc:date>2021-06-01T20:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Passthrough creates character vars of length 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745050#M233505</link>
      <description>&lt;P&gt;What type are these columns in SQL Server? You can define variable lengths in SAS for these also. Also we have SAS option COMPRESS = YES set to avoid disk space blowing out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 21:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745050#M233505</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-06-01T21:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Passthrough creates character vars of length 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745156#M233542</link>
      <description>&lt;P&gt;Thanks that is a good direction to question.&amp;nbsp; The SQL column is varchar(max).&amp;nbsp; It is used to store multiple types of data with an associated key field.&amp;nbsp; It looks like the field that is being returned was created as an integer when it should have been a character field of length 10.&amp;nbsp; Instead it was stored as an integer hence the max length standard integer being returned.&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 12:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745156#M233542</guid>
      <dc:creator>jlh368</dc:creator>
      <dc:date>2021-06-02T12:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Passthrough creates character vars of length 32767</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745168#M233548</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/111984"&gt;@jlh368&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks that is a good direction to question.&amp;nbsp; The SQL column is varchar(max).&amp;nbsp; It is used to store multiple types of data with an associated key field.&amp;nbsp; It looks like the field that is being returned was created as an integer when it should have been a character field of length 10.&amp;nbsp; Instead it was stored as an integer hence the max length standard integer being returned.&amp;nbsp; Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So the cause seems to be the way the variable is defined in the remote database.&amp;nbsp;&amp;nbsp;The variable is begin defined as length $32767 in SAS because that is the maximum length that SAS allows for a character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using implicit passthru you can control the SAS type created by using the DBSASTYPE= dataset option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second part of your message does not make any sense to me.&amp;nbsp; If the variable is defined as an INTEGER in the remote database then SAS will transfer it to a numeric variable (SAS stores all numbers as 8 byte floating point numbers).&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 12:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Passthrough-creates-character-vars-of-length-32767/m-p/745168#M233548</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-02T12:49:48Z</dc:date>
    </item>
  </channel>
</rss>

