Previous Page | Next Page

The SQL Pass-Through Facility for Relational Databases

DISCONNECT Statement



Terminates the connection to the DBMS
Valid in: PROC SQL steps (when accessing DBMS data using SAS/ACCESS software)

Syntax
Arguments
Example

Syntax

DISCONNECT FROM dbms-name | alias

The DISCONNECT statement ends the connection with the DBMS. If you do not include the DISCONNECT statement, SAS performs an implicit DISCONNECT 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 for more information about these macro variables.


Arguments

Use one of these 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 DBMS name or alias in the DISCONNECT statement must match what you specified in the CONNECT statement.  [cautionend]

alias

specifies an alias that was defined in the CONNECT statement.


Example

To exit the SQL pass-through facility, use the facilities DISCONNECT statement and then QUIT the PROC SQL statement. This 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);
...more SAS statements...
disconnect from dbcon1;
quit;

Previous Page | Next Page | Top of Page