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.

426 Syntax <strong>for</strong> the SQL Pass-Through Facility <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong> 4 Chapter 13Not all <strong>SAS</strong>/<strong>ACCESS</strong> interfaces support this feature, however. To determine whetherit is available in your environment, see “Introduction” on page 75.Here are the tasks that you can complete by using the SQL pass-through facility.3 Establish and terminate connections with a DBMS using its CONNECT andDISCONNECT3 Send dynamic, non-query, DBMS-specific SQL statements to a DBMS using itsEXECUTE statement.3 Retrieve data directly from a DBMS using its CONNECTION TO component inthe FROM clause of a PROC SQL SELECT statement.You can use SQL pass-through facility statements in a PROC SQL query, or you canstore them in an SQL view. When you create an SQL view, any arguments that youspecify in the CONNECT statement are stored with the view. There<strong>for</strong>e, when you usethe view in a <strong>SAS</strong> program, <strong>SAS</strong> can establish the appropriate connection to the DBMS.Syntax <strong>for</strong> the SQL Pass-Through Facility <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong>OverviewThis section presents the syntax <strong>for</strong> the SQL pass-through facility statements andthe CONNECTION TO component. For DBMS-specific details, see the documentation<strong>for</strong> your <strong>SAS</strong>/<strong>ACCESS</strong> interface.PROC SQL ;CONNECT TO dbms-name ;DISCONNECT FROM dbms-name | alias;EXECUTE (dbms-specific-SQL-statement) BYdbms-name | alias;SELECT column-list FROM CONNECTION TO dbms-name | alias (dbms-query)Return CodesAs you use the PROC SQL statements that are available in the SQL pass-throughfacility, any error return codes and error messages are written to the <strong>SAS</strong> log. Thesecodes and messages are available to you through these <strong>SAS</strong> macro variables:SQLXRCcontains the DBMS return code that identifies the DBMS error.SQLXMSGcontains descriptive in<strong>for</strong>mation about the DBMS error that the DBMS generates.The contents of the SQLXRC and SQLXMSG macro variables are printed in the <strong>SAS</strong>log using the %PUT macro. They are reset after each SQL pass-through facilitystatement has been executed.See “Macro Variables <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong>” on page 401 <strong>for</strong> more in<strong>for</strong>mationabout these return codes.

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

Saved successfully!

Ooh no, something went wrong!