A SERVICE OF

logo

86 DBCONTERM= LIBNAME Option Chapter 9
The SAS/ACCESS engine retrieves the stored procedure and executes it.
See Also
“DBCONTERM= LIBNAME Option” on page 86
DBCONTERM= LIBNAME Option
Specifies a user-defined termination command to be executed before every disconnect from the
DBMS that is within the scope of the LIBNAME statement or libref
Valid in:
the SAS/ACCESS LIBNAME statement
DBMS support:
DB2 OS/390, DB2 UNIX/PC, Informix, ODBC, OLE DB, Oracle,
Microsoft SQL Server, SYBASE, Teradata
Default value:
none
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.
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.