<?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: Loading SAS datetime into Teradata timestamp works but returns an error in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390440#M11810</link>
    <description>&lt;P&gt;Thanks for the suggestion kiranv.&amp;nbsp; I saw this info about the SASDATEFMT= option already and I figured it doesn't apply to my value--it's already a numeric datetime value.&amp;nbsp; But maybe I'm getting&amp;nbsp;thrown off because in their INSERT example they're using a&amp;nbsp;a datetime literal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll give it a try.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2017 22:12:27 GMT</pubDate>
    <dc:creator>bentleyj1</dc:creator>
    <dc:date>2017-08-23T22:12:27Z</dc:date>
    <item>
      <title>Loading SAS datetime into Teradata timestamp works but returns an error</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390410#M11808</link>
      <description>&lt;P&gt;I need to insert a value into a Teradata table that has a timestamp( 6) field named trigger_timestamp.&amp;nbsp; I’m deriving a SAS datetime macro &amp;nbsp;variable named _triggerRunDt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Loading &amp;amp;_triggerRunDt into trigger_timestamp returns the error ‘Teradata execute: Invalid operation for DateTime or Interval’ &amp;nbsp;but the value is loaded correctly:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="timestamp.jpg" style="width: 121px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14624i06EDA33EA9834E95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="timestamp.jpg" alt="timestamp.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Teradata documentation has this explanation for the error message:&lt;/P&gt;&lt;DIV class="MessageText"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5407&amp;nbsp;&amp;nbsp; Invalid operation for DateTime or Interval.&lt;/DIV&gt;&lt;DIV class="MessageSubhead"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Explanation:&amp;nbsp; An operation that requires an appropriate DateTime or Interval data type or value, and it does not.&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone suggest how to get rid of the error? I don’t have a problem loading Teradata date fields, only timestamps.&amp;nbsp; Here are the relevant sections from the log.&amp;nbsp;&amp;nbsp; Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MPRINT(ONE):&amp;nbsp;&amp;nbsp; libname refTabls teradata user="GIB_TEST" password="{SAS002}9B8C3F4E4E42CE1D1693C5F648AE11641F188708"&lt;/P&gt;&lt;P&gt;server='ROCK.GIBRALTER.COM' database=MAIN mode=ansi connection_group=cefGroup dbsaslabel=none dbsliceparm=(none);&lt;/P&gt;&lt;P&gt;NOTE: Libref REFTABLS was successfully assigned as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Engine:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TERADATA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Physical Name: ROCK.GIBRALTER.COM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE): ;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; triggerRunDt=DHMS(today(),hour(time()),minute(time()),second(time()))+60*60*5;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; call symputx('_triggerRunDt',triggerRunDt);&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; format triggerRunDt datetime.;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; put _all_;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;triggerRunDt=23AUG17:18:10:09 _ERROR_=0 _N_=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_TRIGGERRUNDT=1819131009.2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; insert into refTabls.PROCESS_TRIGGER (cmpn_cd, cmpn_type_cd, prod_test_cd, process, analyst_id, email_list_id_1 , source_schema, source_object, trigger_timestamp, delayed_process, delayed_suffix) values("600210", "HEP", 'TEST', 'CMPN_CREATE' , "bullwinkle@home.com", "rocky@home.com'", "DT_D_CHESS", "P10081_LOAD_TABLE", 1819131009, 'NA', 'NA');&lt;/P&gt;&lt;P&gt;ERROR: Teradata execute: Invalid operation for DateTime or Interval.&lt;/P&gt;&lt;P&gt;NOTE: The following 1 column(s) in REFTABLS.WFPDMHL_CEF_PROCESS_TRIGGER have been automatically dropped because they have a datatype that is not supported by this engine:&lt;/P&gt;&lt;P&gt;delayed_output_list&lt;/P&gt;&lt;P&gt;NOTE: 1 row was inserted into REFTABLS.WFPDMHL_CEF_PROCESS_TRIGGER.&lt;/P&gt;&lt;P&gt;MPRINT(RUN_CREATE):&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 20:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390410#M11808</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2017-08-23T20:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS datetime into Teradata timestamp works but returns an error</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390425#M11809</link>
      <description>&lt;P&gt;try using sasdatefmt. please check the link below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371624.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371624.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 20:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390425#M11809</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-08-23T20:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS datetime into Teradata timestamp works but returns an error</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390440#M11810</link>
      <description>&lt;P&gt;Thanks for the suggestion kiranv.&amp;nbsp; I saw this info about the SASDATEFMT= option already and I figured it doesn't apply to my value--it's already a numeric datetime value.&amp;nbsp; But maybe I'm getting&amp;nbsp;thrown off because in their INSERT example they're using a&amp;nbsp;a datetime literal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll give it a try.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 22:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390440#M11810</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2017-08-23T22:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS datetime into Teradata timestamp works but returns an error</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390442#M11811</link>
      <description>&lt;P&gt;Numeric value of datetime in SAS and Teradata values will be entirely different, as both of them store date &amp;nbsp;entirely different manner. I am not sure why would like to insert numeric date values. It would be always safer, clearner to use them as datetime values.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 22:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390442#M11811</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-08-23T22:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS datetime into Teradata timestamp works but returns an error</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390447#M11812</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22768"&gt;@bentleyj1&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You definitely need to pass in the datetime value as a datetime string and not as a SAS specific number for a datetime.&lt;/P&gt;
&lt;P&gt;It just needs to be something which informs the SAS/Access engine that its dealing with a SAS Datime value so that it converts it to a target database specific value.&lt;/P&gt;
&lt;P&gt;One option:&amp;nbsp;"23AUG17:18:10:09" dt&lt;/P&gt;
&lt;PRE&gt;PROC sql;

INSERT INTO refTabls.PROCESS_TRIGGER (
	cmpn_cd
	,cmpn_type_cd
	,prod_test_cd
	,process
	,analyst_id
	,email_list_id_1
	,source_schema
	,source_object
	,trigger_timestamp
	,delayed_process
	,delayed_suffix
	)
VALUES (
	"600210"
	,"HEP"
	,'TEST'
	,'CMPN_CREATE'
	,"bullwinkle@home.com"
	,"rocky@home.com'"
	,"DT_D_CHESS"
	,"P10081_LOAD_TABLE"
	,"23AUG17:18:10:09"dt
	,'NA'
	,'NA'
	);

quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S: I strongly recommend to not post or obfuscate things like credentials. Just replace these bits with ****&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 22:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/390447#M11812</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-23T22:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS datetime into Teradata timestamp works but returns an error</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/391252#M11843</link>
      <description>&lt;P&gt;I wasn't able to get sasdatefm= &amp;nbsp;for my query.&amp;nbsp; I'm inserting macro variables and literals so I wasn't selecting from a data source so there was no where to place the sasdatefmt.&amp;nbsp; I could have rewritten it to use a dummy data soure but instead used a datetime literal.&amp;nbsp; Thanks for the suggestion though.&amp;nbsp; I certainly remember this approach.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 15:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Loading-SAS-datetime-into-Teradata-timestamp-works-but-returns/m-p/391252#M11843</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2017-08-28T15:03:48Z</dc:date>
    </item>
  </channel>
</rss>

