A SERVICE OF

logo

The Pass-Through Facility for Relational Databases DISCONNECT Statement 233
connection=global);
%put &sqlxmsg &sqlxrc;
Note: You may be able to omit the CONNECT statement and implicitly connect to a
database using default settings. See the documentation for your SAS/ACCESS interface
for more information.
DISCONNECT Statement
Terminates the connection to the DBMS
Valid in:
PROC SQL steps (when accessing DBMS data using SAS/ACCESS software)
Syntax
DISCONNECT FROM dbms-name | alias
The DISCONNECT statement ends the connection with the DBMS. If the
DISCONNECT statement is omitted, an implicit DISCONNECT is performed when
PROC SQL terminates. The SQL procedure continues to execute until you submit a
QUIT statement, another SAS procedure, or a DATA step.
Any return code or message that is generated by the DBMS is available in the macro
variables SQLXRC and SQLXMSG after the statement executes. See “Macro Variables
for Relational Databases” on page 219 for more information on these macro variables.
Arguments
You use one of the following arguments with the DISCONNECT statement:
dbms-name
specifies the database management system from which you want to disconnect.
You must specify the DBMS name for your SAS/ACCESS interface , or use an alias
in the DISCONNECT statement.
Note: If you used the CONNECT statement to connect to the DBMS, the
DISCONNECT statement’s DBMS name or alias must match the name or alias
that you specified in the CONNECT statement.
alias
specifies an alias that was defined in the CONNECT statement.
Example
To exit the Pass-Through Facility, use the facilities DISCONNECT statement and
then QUIT the PROC SQL statement. The following example disconnects the user from
a DB2 database with the alias DBCON1 and terminates the SQL procedure:
proc sql;
connect to db2 as dbcon1 (ssid=db2a);
....
disconnect from dbcon1;