简体   繁体   English

如何在不使用SQL沙箱的情况下使用SAS数据集创建易失表inn Teradata

[英]How to create volatile table inn teradata using SAS dataset without sql sandbox

I have a SAS dataset and I need to create a volatile table in Teradata using the SAS dataset. 我有一个SAS数据集,我需要使用SAS数据集在Teradata中创建一个易失表。 But, I do not have a sandbox to store the table on Teradata server. 但是,我没有沙盒将表存储在Teradata服务器上。 Is there a way that I can create a Teradata volatile table from a SAS dataset without SQL Sandbox. 有没有一种方法可以从没有SQL Sandbox的SAS数据集中创建Teradata易失表。

It is pretty simple to create a volatile table in Teradata, just use the dbmstemp=yes option on your libname statement. 在Teradata中创建一个易失表非常简单,只需在libname语句上使用dbmstemp=yes选项即可。

libname TDWORK teradata connection=global dbmstemp=yes .... ;
data tdwork.test1 ;
  set sashelp.class ;
run;

Make sure to use the connection=global option on all of your LIBNAME and CONNECT statements so that all of the connections to Teradata use the same session so you can see your volatile table. 确保在所有LIBNAME和CONNECT语句上使用connection=global选项,以便与Teradata的所有连接都使用相同的会话,以便可以看到易失表。 Keep at least one of the libref's open so that the connection persists. 保持至少一个libref处于打开状态,以便连接持续存在。

Then you could also use passthru SQL to create a volatile table. 然后,您还可以使用passthru SQL创建一个易失表。

proc sql ;
  connect to teradata (connection=global .... );
  execute (
    create volatile table test2 as (
      select * from test1
    ) with data on commit preserve rows 
  ) by teradata;
quit;

Or to reference the volatile tables in pass thru SQL code. 或通过SQL代码引用易失表。

So if you wanted to pull out of Teradata all the records from MYDB.MYTABLE where NAME was in the list of names you uploaded into the volatile table TEST1 you made with the first data step above you could use code like this: 因此,如果要从Teradata中提取MYDB.MYTABLE中的所有记录,其中NAME在您上载到易失性表TEST1的名称列表中,则可以使用上面的第一个数据步骤制作此代码:

proc sql ;
  connect to teradata (connection=global .... );
  create table mytest as select * from connection to teradata 
  ( select * from mydb.mytable 
    where name in (select name from test1)
  );
quit;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM