13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

406 DBIDIRECTEXEC= System Option 4 Chapter 12Be<strong>for</strong>e an SQL statement can be processed, all librefs that are associated with thestatement must reference compatible data sources. For example, a CREATE TABLE ASSELECT statement that creates an Oracle table by selecting from a <strong>SAS</strong> table is notsent to the database <strong>for</strong> execution because the data sources are not compatible.The libref must also use the same database server <strong>for</strong> all compatible data sources.ExampleThis example creates a temporary table from a SELECT statement using theDBIDIRECTEXEC system option.libname lib1 db2 user=andy password=andypwd datasrc=sample connection=global;libname lib2 db2 user=mike password=mikepwd datasrc=sampleconnection=global dbmstemp=yes;data lib1.tab1;a=1;b=’one’;run;options dbidirectexec sastraceloc=saslog;proc sql;create table lib2.tab1 asselect * from lib1.tab1;quit;In this next example, two librefs point to the same database server but use differentschemas.libname lib1 db2 user=henry password=henrypwd datasrc=sample;libname lib2 db2 user=scott password=scottpwd datasrc=sample;data lib1.tab1;a=1;b=’one’;run;options dbidirectexec sastraceloc=saslog;proc sql;create table lib2.tab2 asselect * from lib1.t1;quit;This example shows how a statement can be passed directly to the database <strong>for</strong>execution, if you specify DBIDIRECTEXEC.libname company oracle user=scott pw=tiger path=mydb;proc sql;create table company.hr_tab asselect * from company.empwhere deptid = ’HR’;quit;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!