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.

664 Special Catalog Queries 4 Chapter 23(select empid, lastname, firstname,hiredate, salary from sasdemo.employeeswhere hiredate>=’31.12.1988’);disconnect from mycon;quit;This example connects to Microsoft Access and creates a view NEWORDERS from allcolumns in the ORDERS table.proc sql;connect to odbc as mydb(datasrc=MSAccess7);create view neworders asselect * from connection to mydb(select * from orders);disconnect from mydb;quit;This next example sends an SQL query to Microsoft SQL Server, configured underthe data source name SQL Server, <strong>for</strong> processing. The results from the query serve asa virtual table <strong>for</strong> the PROC SQL FROM clause.proc sql;connect to odbc as mydb(datasrc="SQL Server" user=testuser password=testpass);select * from connection to mydb(select CUSTOMER, NAME, COUNTRYfrom CUSTOMERSwhere COUNTRY ’USA’);quit;This example returns a list of the columns in the CUSTOMERS table.proc sql;connect to odbc as mydb(datasrc="SQL Server" user=testuser password=testpass);select * from connection to mydb(ODBC::SQLColumns (, , "CUSTOMERS"));quit;Special Catalog Queries<strong>SAS</strong>/<strong>ACCESS</strong> Interface to ODBC supports the following special queries. Manydatabases provide or use system tables that allow queries to return the list of availabletables, columns, procedures, and other useful in<strong>for</strong>mation. ODBC provides much of thisfunctionality through special application programming interfaces (APIs) toaccommodate databases that do not follow the SQL table structure. You can use thesespecial queries on SQL and non-SQL databases.Here is the general <strong>for</strong>mat of the special queries:ODBC::SQLAPI “parameter 1”,”parameter n”ODBC::is required to distinguish special queries from regular queries.

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

Saved successfully!

Ooh no, something went wrong!