<?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 PROC SQL INSERT CURRENT_TIMESTAMP  Teradata in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INSERT-CURRENT-TIMESTAMP-Teradata/m-p/8679#M354</link>
    <description>So I’m confused. I am using pass through SQL because I specified the connection and not the lib name. My understanding is I need to format such that Teradata understand the SQL. Which I have done. However I seem to not have done so that SAS will process it. I can not use Teradata sub-commands in pass through ? If not how can I accomplish what I am trying to do below and insert the current timestamp. I can create a data set and build the date and put to a variable, but is the REALLY the best way to do this ?&lt;BR /&gt;
&lt;BR /&gt;
I get a syntax error because it can not recognize current_timestamp. Any help would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
%macro updatingtables;&lt;BR /&gt;
&lt;BR /&gt;
 proc sql;&lt;BR /&gt;
      connect to teradata (user=user password="password" &lt;BR /&gt;
      server=server1 mode=teradata);&lt;BR /&gt;
      execute(INSERT INTO TDDatabase.Tablename  &lt;BR /&gt;
                                                 ( column1             &lt;BR /&gt;
                                                 ,column2             &lt;BR /&gt;
                                                 ,column3  &lt;BR /&gt;
                                                 ,column4   &lt;BR /&gt;
                                                 ,column5      &lt;BR /&gt;
                                                 ,column6        &lt;BR /&gt;
                                                 ,column7  ) &lt;BR /&gt;
                                                 VALUES&lt;BR /&gt;
                                                 ("&amp;amp;data1"&lt;BR /&gt;
                                                 ,"&amp;amp;data2"      &lt;BR /&gt;
                                                 ,"&amp;amp;data3"  &lt;BR /&gt;
                                                 ,"&amp;amp;data4"   &lt;BR /&gt;
                                                 ,"&amp;amp;data5"  &lt;BR /&gt;
                                                 ,'COMPLETE'  &lt;BR /&gt;
                                                 ,CURRENT_TIMESTAMP) );&lt;BR /&gt;
          by teradata;&lt;BR /&gt;
          disconnect from teradata;         &lt;BR /&gt;
          quit;&lt;BR /&gt;
         &lt;BR /&gt;
%mend updatingtables;      &lt;BR /&gt;
&lt;BR /&gt;
%updatingtables</description>
    <pubDate>Sat, 12 Feb 2011 01:03:27 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2011-02-12T01:03:27Z</dc:date>
    <item>
      <title>PROC SQL INSERT CURRENT_TIMESTAMP  Teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INSERT-CURRENT-TIMESTAMP-Teradata/m-p/8679#M354</link>
      <description>So I’m confused. I am using pass through SQL because I specified the connection and not the lib name. My understanding is I need to format such that Teradata understand the SQL. Which I have done. However I seem to not have done so that SAS will process it. I can not use Teradata sub-commands in pass through ? If not how can I accomplish what I am trying to do below and insert the current timestamp. I can create a data set and build the date and put to a variable, but is the REALLY the best way to do this ?&lt;BR /&gt;
&lt;BR /&gt;
I get a syntax error because it can not recognize current_timestamp. Any help would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
%macro updatingtables;&lt;BR /&gt;
&lt;BR /&gt;
 proc sql;&lt;BR /&gt;
      connect to teradata (user=user password="password" &lt;BR /&gt;
      server=server1 mode=teradata);&lt;BR /&gt;
      execute(INSERT INTO TDDatabase.Tablename  &lt;BR /&gt;
                                                 ( column1             &lt;BR /&gt;
                                                 ,column2             &lt;BR /&gt;
                                                 ,column3  &lt;BR /&gt;
                                                 ,column4   &lt;BR /&gt;
                                                 ,column5      &lt;BR /&gt;
                                                 ,column6        &lt;BR /&gt;
                                                 ,column7  ) &lt;BR /&gt;
                                                 VALUES&lt;BR /&gt;
                                                 ("&amp;amp;data1"&lt;BR /&gt;
                                                 ,"&amp;amp;data2"      &lt;BR /&gt;
                                                 ,"&amp;amp;data3"  &lt;BR /&gt;
                                                 ,"&amp;amp;data4"   &lt;BR /&gt;
                                                 ,"&amp;amp;data5"  &lt;BR /&gt;
                                                 ,'COMPLETE'  &lt;BR /&gt;
                                                 ,CURRENT_TIMESTAMP) );&lt;BR /&gt;
          by teradata;&lt;BR /&gt;
          disconnect from teradata;         &lt;BR /&gt;
          quit;&lt;BR /&gt;
         &lt;BR /&gt;
%mend updatingtables;      &lt;BR /&gt;
&lt;BR /&gt;
%updatingtables</description>
      <pubDate>Sat, 12 Feb 2011 01:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INSERT-CURRENT-TIMESTAMP-Teradata/m-p/8679#M354</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-12T01:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INSERT CURRENT_TIMESTAMP  Teradata</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INSERT-CURRENT-TIMESTAMP-Teradata/m-p/8680#M355</link>
      <description>I will answer this in the event someone else needs the same information. &lt;BR /&gt;
&lt;BR /&gt;
a) I had a semicolon incorrectly oustide the parens at the end of my value list&lt;BR /&gt;
b) I had an issue with needing double quotes to resolve the variable, and needing single quotes for Teradata. The %str lets me resolve the variable and still use single quotes.&lt;BR /&gt;
c) casting the current_timestamp let me get the value i needed.&lt;BR /&gt;
&lt;BR /&gt;
I'm relatively new to SAS, and forums like this are invaluable for developers. Hopefully this information is helpful. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro updatingtables;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
connect to teradata (user=user password="password" &lt;BR /&gt;
server=server1 mode=teradata);&lt;BR /&gt;
execute(INSERT INTO TDDatabase.Tablename &lt;BR /&gt;
( column1 &lt;BR /&gt;
,column2 &lt;BR /&gt;
,column3 &lt;BR /&gt;
,column4 &lt;BR /&gt;
,column5 &lt;BR /&gt;
,column6 &lt;BR /&gt;
,column7 ) &lt;BR /&gt;
VALUES&lt;BR /&gt;
( %str(%')&amp;amp;data1%str(%')&lt;BR /&gt;
,%str(%')&amp;amp;data2%str(%')&lt;BR /&gt;
,%str(%')&amp;amp;data3%str(%')&lt;BR /&gt;
,%str(%')&amp;amp;data4%str(%')&lt;BR /&gt;
,%str(%')&amp;amp;data5%str(%')&lt;BR /&gt;
,'COMPLETE' &lt;BR /&gt;
,CAST((CURRENT_TIMESTAMP) AS TIMESTAMP(6)); )&lt;BR /&gt;
by teradata;&lt;BR /&gt;
disconnect from teradata; &lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
%mend updatingtables; &lt;BR /&gt;
&lt;BR /&gt;
%updatingtables&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Sprtsnut

Message was edited by: Sprtsnut</description>
      <pubDate>Sat, 12 Feb 2011 06:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INSERT-CURRENT-TIMESTAMP-Teradata/m-p/8680#M355</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-12T06:01:42Z</dc:date>
    </item>
  </channel>
</rss>

