sp_addextendedproc

Creates an extended stored procedure (ESP) in the master database.

Syntax

sp_addextendedproc esp_name, dll_name

Parameters

Examples

Usage

There are additional considerations when using sp_addextendedproc:
  • Execute sp_addextendedproc from the master database.

  • You can only use sp_addextendedproc to add extended stored procedures that take no parameters. If your extended stored procedure requires a formal parameter list, you must use the create procedure command with the as external name option, together with the complete parameter list.

  • The esp_name is case sensitive. It must match the name of the function in the DLL.

  • The DLL represented by dll_name must reside on the server machine on which the ESP is being created and the DLL directory must be in:

    • Windows – $PATH

    • Compaq Tru64 – $LD_LIBRARY_PATH

    • HP – $SH_LIBRARY_PATH

    If the file is not found, the search mechanism also searches $SYBASE/dll on Windows and $SYBASE/lib on other platforms.

  • (On Windows) An ESP function should not call a C run-time signal routine. This can cause XP Server to fail, because Open Server™ does not support signal handling on Windows.

See also create procedure in Reference Manual: Commands.

Permissions

The permission checks for sp_addextendedproc differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be a user with manage any ESP privilege.

Disabled

With granular permissions disabled, you must be a user with sa_role.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_dropextendedproc
sp_helpextendedproc