<?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: Creating a volatile table in Teradata to join with a real table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870279#M343747</link>
    <description>You are right. I created a lib name for the second database connection and&lt;BR /&gt;referred to the temp table with a TDWORK prefix. It worked. The only&lt;BR /&gt;concern is that it's taking a very long time to create the temp table with&lt;BR /&gt;the set statement. Don't know if that is due to my particular environment,&lt;BR /&gt;or due to SAS.</description>
    <pubDate>Tue, 18 Apr 2023 00:11:29 GMT</pubDate>
    <dc:creator>jitb</dc:creator>
    <dc:date>2023-04-18T00:11:29Z</dc:date>
    <item>
      <title>Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869808#M343575</link>
      <description>&lt;P&gt;I am trying to create a volatile table in Teradata that I would like to join with a real teradata table on a common variable. I am able to create the volatile table, as below.&lt;/P&gt;
&lt;P&gt;libname TDWORK teradata user="&amp;amp;user.@LDAP" password=&amp;amp;pword tdpid=bmg dbmstemp=yes connection=global;&lt;BR /&gt;/*proc sql; drop table TDWORK.FDR_TIN_jb; quit;*/&lt;/P&gt;
&lt;P&gt;data TDWORK.FDR_TIN_jb ;&lt;BR /&gt;set one_per_good_ssn(obs=100);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sql ;&lt;BR /&gt;connect to teradata (connection=global user="&amp;amp;user.@LDAP" password=&amp;amp;pword tdpid=bmg);&lt;BR /&gt;execute (&lt;BR /&gt;create volatile table test as (&lt;BR /&gt;select * from FDR_TIN_jb&lt;BR /&gt;) with data on commit preserve rows &lt;BR /&gt;) by teradata;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I try to join this volatile table with a real table, it gives me an error.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ERROR: Teradata prepare: Object 'test' does not exist.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The code I am using is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sql ; &lt;BR /&gt;connect to teradata(user="&amp;amp;user.@LDAP" password=&amp;amp;pword tdpid=bmg database=Bmgpcust mode=teradata);&lt;BR /&gt;create table Cust_Mstr_Wk_Curr_Cdb as select * from connection to teradata&lt;BR /&gt;( Select&lt;BR /&gt;/* a.* ,*/&lt;BR /&gt;b.Cust_Tin ,&lt;BR /&gt;b.Cust_Num ,&lt;BR /&gt;b.Cust_Co_Id ,&lt;BR /&gt;b.Cust_Tin_Cd &lt;BR /&gt;from test a ,&lt;BR /&gt;Bmgpcust.Cust_Mstr_Wk_Curr_Cdb b &lt;BR /&gt;where a.SSN = b.Cust_Tin&lt;BR /&gt;);&lt;BR /&gt;quit;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Any help would be much appreciated! Thanks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jit&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 14:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869808#M343575</guid>
      <dc:creator>jitb</dc:creator>
      <dc:date>2023-04-14T14:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869811#M343578</link>
      <description>&lt;P&gt;Don't make a NEW connection for your SQL code.&amp;nbsp; That will probably result in a new volatile table space.&lt;/P&gt;
&lt;P&gt;Use the one you already have instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TDWORK.FDR_TIN_jb ;
  set one_per_good_ssn(obs=100);
run;

proc sql ;
connect using TDWORK ;
execute by tdwork
(create volatile table test as 
  (select * from FDR_TIN_jb
  ) with data on commit preserve rows
) ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 14:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869811#M343578</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-14T14:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869817#M343581</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried this and your code works to create TEST, but it's still giving me the same error when I try to join.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt; ERROR: Teradata prepare: Object 'test' does not exist.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 14:59:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869817#M343581</guid>
      <dc:creator>jitb</dc:creator>
      <dc:date>2023-04-14T14:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869921#M343621</link>
      <description>&lt;P&gt;Please post your SAS log in that case. Are you doing it in the same SQL step and connection?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 22:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/869921#M343621</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-04-14T22:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870050#M343653</link>
      <description>&lt;P&gt;Yes, in the same session. Here is the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;73 /* Temp Table of SSN to join with BMG */&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 libname TDWORK teradata&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;SYMBOLGEN: Macro variable USER resolves to&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;SYMBOLGEN: Macro variable PWORD resolves to&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 ! user="&amp;amp;user.@LDAP" password=&amp;amp;pword tdpid=bmg dbmstemp=yes connection=global;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV id="sasLogNote1_1681648601886" class="sasNote"&gt;NOTE: Libref TDWORK was successfully assigned as follows:&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Engine: TERADATA&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Physical Name: bmg&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV class="sasSource"&gt;75 /*proc sql; drop table TDWORK.FDR_TIN_jb; quit;*/&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;76&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;77 data TDWORK.FDR_TIN_jb ;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;78 set one_per_good_ssn(obs=100);&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;79 run;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogNote2_1681648601886" class="sasNote"&gt;NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.&lt;/DIV&gt;
&lt;DIV id="sasLogNote3_1681648601886" class="sasNote"&gt;NOTE: There were 100 observations read from the data set WORK.ONE_PER_GOOD_SSN.&lt;/DIV&gt;
&lt;DIV id="sasLogNote4_1681648601886" class="sasNote"&gt;NOTE: The data set TDWORK.FDR_TIN_jb has 100 observations and 3 variables.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV id="sasLogNote5_1681648601886" class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 4.12 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;80&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;81 proc sql ;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;82 connect using TDWORK ;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;83 execute by TDWORK (&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;84 create volatile table test as (&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;85 select * from FDR_TIN_jb&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;86 ) with data on commit preserve rows&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;87 );&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;88 quit;&lt;/DIV&gt;
&lt;DIV id="sasLogNote6_1681648601886" class="sasNote"&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.05 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;89&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;90 /*proc print data=tdwork.test; run;*/&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;91&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;92 /* Join on SSN to get CUST_NUM */&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;93 proc sql ;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;93 !&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;94 connect to&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;94 ! teradata(user="&amp;amp;user.@LDAP" password=&amp;amp;pword tdpid=bmg database=Bmgpcust mode=teradata);&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;SYMBOLGEN: Macro variable USER resolves to&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;SYMBOLGEN: Macro variable PWORD resolves to&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;95 create table Cust_Mstr_Wk_Curr_Cdb as select * from connection to teradata&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;96 ( Select&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;97 a.SSN ,&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;98 b.Cust_Tin ,&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;99 b.Cust_Num ,&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;100 b.Cust_Co_Id&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;101 from test a, /* Problem in syntax here */&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;102 Bmgpcust.Cust_Mstr_Wk_Curr_Cdb b&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;103 where a.SSN = b.Cust_Tin&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;104 );&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1681648601886" class="sasError"&gt;ERROR: Teradata prepare: Object 'test' does not exist. SQL statement was: Select a.SSN , b.Cust_Tin , b.Cust_Num , b.Cust_Co_Id&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;from test a, Bmgpcust.Cust_Mstr_Wk_Curr_Cdb b where a.SSN = b.Cust_Tin.&lt;/DIV&gt;
&lt;DIV id="sasLogNote7_1681648601886" class="sasNote"&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;105 quit;&lt;/DIV&gt;
&lt;DIV id="sasLogNote8_1681648601886" class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;
&lt;DIV id="sasLogNote9_1681648601886" class="sasNote"&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.39 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE id="pre_sasLog_4358" class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2023 12:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870050#M343653</guid>
      <dc:creator>jitb</dc:creator>
      <dc:date>2023-04-16T12:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870061#M343660</link>
      <description>&lt;P&gt;Why do you keep making NEW connections to Teradata?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Make connection to teradata for volatile tables ; 
libname tdwork teradata ... dbmstemp=yes ... ;

* Make volatile table using SAS code ;
data TDWORK.FDR_TIN_jb ;
   set one_per_good_ssn(obs=100);
run;

* Make volatile table using Teradata code ;
proc sql ;
connect using TDWORK as teradata;
execute by teradata 
(create volatile table test as 
 (select * from FDR_TIN_jb
 ) with data on commit preserve rows
);
quit;

* Reference volatile table and permanent table using Teradata code ;
proc sql ;
connect using TDWORK as teradata;
create table Cust_Mstr_Wk_Curr_Cdb as 
select * from connection to teradata
( Select
    a.SSN 
  , b.Cust_Tin 
  , b.Cust_Num 
  , b.Cust_Co_Id
  from test a
     , Bmgpcust.Cust_Mstr_Wk_Curr_Cdb b
  where a.SSN = b.Cust_Tin
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Apr 2023 14:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870061#M343660</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-16T14:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870279#M343747</link>
      <description>You are right. I created a lib name for the second database connection and&lt;BR /&gt;referred to the temp table with a TDWORK prefix. It worked. The only&lt;BR /&gt;concern is that it's taking a very long time to create the temp table with&lt;BR /&gt;the set statement. Don't know if that is due to my particular environment,&lt;BR /&gt;or due to SAS.</description>
      <pubDate>Tue, 18 Apr 2023 00:11:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870279#M343747</guid>
      <dc:creator>jitb</dc:creator>
      <dc:date>2023-04-18T00:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870280#M343748</link>
      <description>&lt;P&gt;Have a look at the DBCOMMIT and INSERTBUFF settings for Teradata. In my experience the default settings are not optimal and usually need changing to get way better table loading performance. INSERTBUFF = 10000 is my usual starting point but it pays to experiment.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 00:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870280#M343748</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-04-18T00:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a volatile table in Teradata to join with a real table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870281#M343749</link>
      <description>Thank you so much for the tip. Will try these options to fine tune and post.</description>
      <pubDate>Tue, 18 Apr 2023 00:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-volatile-table-in-Teradata-to-join-with-a-real-table/m-p/870281#M343749</guid>
      <dc:creator>jitb</dc:creator>
      <dc:date>2023-04-18T00:32:29Z</dc:date>
    </item>
  </channel>
</rss>

