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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>SAS</strong>/<strong>ACCESS</strong> Interface to DB2 Under UNIX and PC Hosts 4 Special Catalog Queries 463This example connects to the SAMPLE database by using an alias (DB1) andper<strong>for</strong>ms a query, shown in italic type, on the <strong>SAS</strong>DEMO.CUSTOMERS table.proc sql;connect to db2 as db1 (database=sample);select *from connection to db1(select * from sasdemo.customerswhere customer like ’1%’);disconnect from db1;quit;Special Catalog Queries<strong>SAS</strong>/<strong>ACCESS</strong> Interface to DB2 under UNIX and PC Hosts supports the followingspecial queries. You can use the queries to call the ODBC-style catalog functionapplication programming interfaces (APIs). Here is the general <strong>for</strong>mat of these queries:DB2::SQLAPI “parameter 1”,”parameter n”DB2::is required to distinguish special queries from regular queries.SQLAPIis the specific API that is being called. Neither DB2:: nor SQLAPI are casesensitive."parameter n"is a quoted string that is delimited by commas.Within the quoted string, two characters are universally recognized: the percent sign(%) and the underscore (_). The percent sign matches any sequence of zero or morecharacters, and the underscore represents any single character. To use either characteras a literal value, you can use the backslash character (\) to escape the matchcharacters. For example, this call to SQLTables usually matches table names such asmyatest and my_test:select * from connection to db2 (DB2::SQLTables "test","","my_test");Use the escape character to search only <strong>for</strong> the my_test table:select * from connection to db2 (DB2::SQLTables "test","","my\_test");<strong>SAS</strong>/<strong>ACCESS</strong> Interface to DB2 under UNIX and PC Hosts supports these specialqueries:DB2::SQLDataSourcesreturns a list of database aliases that have been cataloged on the DB2 client.DB2::SQLDBMSIn<strong>for</strong>eturns in<strong>for</strong>mation about the DBMS server and version. It returns one row withtwo columns that describe the DBMS name (such as DB2/NT) and version (such as8.2).

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

Saved successfully!

Ooh no, something went wrong!