<?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: Datetimeoffset Data type not supported? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725533#M225379</link>
    <description>Does this not &lt;A href="https://support.sas.com/kb/39/188.html" target="_blank"&gt;https://support.sas.com/kb/39/188.html&lt;/A&gt; help?&lt;BR /&gt;&lt;BR /&gt;Best regards, Jos</description>
    <pubDate>Thu, 11 Mar 2021 17:36:42 GMT</pubDate>
    <dc:creator>JosvanderVelden</dc:creator>
    <dc:date>2021-03-11T17:36:42Z</dc:date>
    <item>
      <title>Datetimeoffset Data type not supported?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725424#M225329</link>
      <description>&lt;P&gt;I'm trying to query a field named requestdate which is of the datetimeoffset data type from a table named maternitypackages inside a sql server database. If I use a libname statement I can succesfully connect to the database and access the maternitypackage table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname _tt   oledb provider=SQLNCLI11.1 dsn="pwt9094" schema=dbo properties=('Initial Catalog'=MaternityPackageModule 'Integrated Security'=SSPI) uid="" pwd="" dbmax_text=1024 preserve_tab_names=yes access=readonly prompt=no;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But the resulting maternitypackages table does not contain the requestdate field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use the sql passthrough facility of sas I can access this field if I cast it as datetime:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to oledb as mpm
  (provider=SQLNCLI11.1 dsn=pwt9094 schema=dbo 
properties=('Initial Catalog'=MaternityPackageModule 'Integrated Security'=SSPI)
uid="" pwd="" dbmax_text=1024 prompt=no);
create table ss as 
select * from connection to mpm (select cast(requestdate as datetime) as requestdate from maternitypackages);
;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I use the sql passthrough facility to access this field without casting I get an error: "ERROR: At least one of the columns in this DBMS table has a datatype that is not supported by this engine."&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to oledb as mpm
  (provider=SQLNCLI11.1 dsn=pwt9094 schema=dbo 
properties=('Initial Catalog'=MaternityPackageModule 'Integrated Security'=SSPI)
uid="" pwd="" dbmax_text=1024 prompt=no);
create table ss as 
select * from connection to mpm (select requestdate from maternitypackages
                                     );
;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is casting using the sql passthough facility or a view from the database the only way to fix this problem? What is the best practice in this use case?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 13:34:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725424#M225329</guid>
      <dc:creator>HCL1991</dc:creator>
      <dc:date>2021-03-11T13:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Datetimeoffset Data type not supported?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725533#M225379</link>
      <description>Does this not &lt;A href="https://support.sas.com/kb/39/188.html" target="_blank"&gt;https://support.sas.com/kb/39/188.html&lt;/A&gt; help?&lt;BR /&gt;&lt;BR /&gt;Best regards, Jos</description>
      <pubDate>Thu, 11 Mar 2021 17:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725533#M225379</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2021-03-11T17:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Datetimeoffset Data type not supported?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725546#M225387</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mean that I should use&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SQLNCLI10.1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;instead of&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SQLNCLI11.1&lt;/PRE&gt;&lt;P&gt;as provider and this issue will be resolved? If that's the case I can contact our systems administrator to install&amp;nbsp;SQLNCLI10.1. Please verify my assumption.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 18:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725546#M225387</guid>
      <dc:creator>HCL1991</dc:creator>
      <dc:date>2021-03-11T18:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Datetimeoffset Data type not supported?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725550#M225388</link>
      <description>&lt;P&gt;SAS only has two types of variables, floating point numbers and fixed length character strings.&amp;nbsp; To allow you to work with datetime values SAS has some formats, informats and functions that treat the number of seconds since 1960 as a datetime value.&amp;nbsp; But they do not have any concept of storing an offset from GMT in addition to the number of seconds.&amp;nbsp; So for this data to even be usable in SAS you will have to transform it in some way.&amp;nbsp; For example you could eliminate the offset by adjusting the value into either GMT or the servers local time.&amp;nbsp; I assume that is what you say worked for you.&amp;nbsp; Or you could translate it into a string that include the datetime value and the offset.&amp;nbsp; Or store the offset and datetime value as two separate variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like the OLEDB driver you are using does not know how to convert that data type for you.&lt;/P&gt;
&lt;P&gt;You might try using the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=acnrdb&amp;amp;docsetTarget=n14cumxy9v06b9n13eajfzfcxsuf.htm&amp;amp;locale=en" target="_self"&gt;DBSASTYPE= dataset option&lt;/A&gt; and see if SAS will cast the value to a character string that you can read.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 18:46:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetimeoffset-Data-type-not-supported/m-p/725550#M225388</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-11T18:46:04Z</dc:date>
    </item>
  </channel>
</rss>

