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.

598 Connection To Component Examples 4 Chapter 20proc sql;connect to SQLSVR as user1(required = "dsn=User’s Data; uid=testuser");In this example, you can select any data source that is configured on your machine.The example uses the connection method that represents a more advanced level ofMicrosoft SQL Server ODBC con<strong>for</strong>mance, Level 1. When connection succeeds, theconnection string is returned in the SQLXMSG and SYSDBMSG macro variables. Itcan then be stored if you use this method to configure a connection <strong>for</strong> later use.proc sql;connect to SQLSVR (required);This example prompts you to specify the in<strong>for</strong>mation that is required to make aconnection to the DBMS. You are prompted to supply the data source name, user ID,and password in the dialog boxes that are displayed.proc sql;connect to SQLSVR (prompt);Connection To Component ExamplesThis example sends Microsoft SQL Server 6.5 (configured under the data sourcename "SQL Server") an SQL query <strong>for</strong> processing. The results from the query serve asa virtual table <strong>for</strong> the PROC SQL FROM clause. In this example MYDB is theconnection alias.proc sql;connect to SQLSVR as mydb(datasrc="SQL Server" user=testuser password=testpass);select * from connection to mydb(select CUSTOMER, NAME, COUNTRYfrom CUSTOMERSwhere COUNTRY ’USA’);quit;This next example returns a list of the columns in the CUSTOMERS table.proc sql;connect to SQLSVR as mydb(datasrc = "SQL Server" user=testuser password=testpass);select * from connection to mydb(ODBC::SQLColumns (, , "CUSTOMERS"));quit;DBLOAD Procedure Specifics <strong>for</strong> Microsoft SQL ServerOverviewFor general in<strong>for</strong>mation about this feature, see “Overview: DBLOAD Procedure” onpage 911.The Microsoft SQL Server under UNIX hosts interface supports all DBLOADprocedure statements (except ACCDESC=) in batch mode. Here are <strong>SAS</strong>/<strong>ACCESS</strong>Interface to Microsoft SQL Server specifics <strong>for</strong> the DBLOAD procedure.

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

Saved successfully!

Ooh no, something went wrong!