Previous Page | Next Page

The LIBNAME Statement for Relational Databases

DBCONTERM= LIBNAME Option



Specifies a user-defined termination command to execute before every disconnect from the DBMS that is within the scope of the LIBNAME statement or libref.
Default value: none
Valid in: SAS/ACCESS LIBNAME statement
DBMS support: Aster nCluster, DB2 under UNIX and PC Hosts, DB2 under z/OS, Greenplum, HP Neoview, Informix, Microsoft SQL Server, MySQL, Netezza, ODBC, OLE DB, Oracle, Sybase, Sybase IQ, Teradata

Syntax
Syntax Description
Details
Examples
See Also

Syntax

DBCONTERM=<'>DBMS-user-command<'>

Syntax Description

DBMS-user-command

is any valid command that can be executed by the SAS/ACCESS engine and that does not return a result set or output parameters.


Details

The termination command that you select can be a stored procedure or any DBMS SQL statement that might provide additional control over the interaction between the SAS/ACCESS engine and the DBMS. The command executes immediately before SAS terminates each connection to the DBMS. If the command fails, then SAS provides a warning message but the library deassignment and disconnect still occur. You must specify the command as a single, quoted string.

Note:   The termination command might execute more than once, because one LIBNAME statement might have multiple connections--for example, one for reading and one for updating.  [cautionend]


Examples

In the following example, the DBMS drops the Q1_SALES table before SAS disconnects from the DBMS.

libname mydblib db2 user=testuser using=testpass
        db=invoice bconterm='drop table q1_sales';

In the following example, the stored procedure, SALESTAB_STORED_PROC, is executed each time SAS connects to the DBMS, and the BONUSES table is dropped when SAS terminates each connection.

libname mydblib db2 user=testuser
        using=testpass db=sales
        dbconinit='exec salestab_stored_proc'
        dbconterm='drop table bonuses';


See Also

DBCONINIT= LIBNAME Option

Previous Page | Next Page | Top of Page