These examples connect
to a data source that is configured under the data source name
User's
Data
using the alias USER1. The first example uses the
connection method that is guaranteed to be present at the lowest level
of conformance. Note that DATASRC= names can contain quotation marks
and spaces.
proc sql;
connect to sqlsvr as user1
(datasrc="User's Data" user=testuser password=testpass);
This example uses the
connection method that represents a more advanced level of Microsoft
SQL Server ODBC conformance. It uses the input dialog box that is
provided by the driver. The DSN= and UID= arguments are within the
connection string. The SQL pass-through facility therefore does not
parse them but instead passes them to the ODBC driver manager.
proc 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 of Microsoft SQL Server ODBC conformance, Level 1. When connection
succeeds, the connection string is returned in the SQLXMSG and SYSDBMSG
macro variables. It can then be stored if you use this method to configure
a connection for later use.
proc sql;
connect to SQLSVR (required);
This example prompts
you to specify the information that is required to make a connection
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);