Chapter Contents

Previous

Next
DISCONNECT Statement

DISCONNECT Statement



Terminates a connection to the DBMS

Optional statement


Syntax
Arguments
Example

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 SQL Procedure Pass-Through Facility Return Codes 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 a DBMS name, which is listed in your DBMS chapter, 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.  [cautionend]

alias
specifies an alias that was defined in the CONNECT statement.


Example

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;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.