Using sp_addextendedproc

sp_addextendedproc is compatible with the syntax used by Microsoft SQL Server. You can use it as an alternative to create procedure. The syntax is:

sp_addextendedproc esp_name, dll_name

esp_name is the name of the ESP. It must match the name of the function that supports the ESP.

dll_name is the name of the DLL containing the ESP’s supporting function.

sp_addextendedproc must be executed in the master database by a user who has the sa_role. Therefore, sp_addextendedproc always registers the ESP in the master database, unlike create procedure, which registers the ESP in the current database. Unlike create procedure, sp_addextendedproc does not allow for parameter checking in Adaptive Server or for default values for parameters.

The following statements register in the master database an ESP supported by the xp_echo routine described in the example in “ESP function example”, assuming that the function is compiled in a DLL named examples.dll:

use master
sp_addextendedproc "xp_echo", "examples.dll"

See the Reference Manual: Procedures.