Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 3.37 KB

execution-characteristics-of-extended-stored-procedures.md

File metadata and controls

57 lines (40 loc) · 3.37 KB
title description author ms.author ms.date ms.service ms.topic helpviewer_keywords
Execution characteristics of extended stored procedures
Execution Characteristics of Extended Stored Procedures
VanMSFT
vanto
03/14/2017
sql
reference
extended stored procedures [SQL Server], executing
executing extended stored procedures [SQL Server]

Execution Characteristics of Extended Stored Procedures

[!INCLUDE SQL Server]

Important

[!INCLUDEssNoteDepFutureAvoid] Use CLR Integration instead.

The execution of an extended stored procedure has these characteristics:

  • The extended stored procedure function is executed under the security context of [!INCLUDEmsCoName] [!INCLUDEssNoVersion].

  • The extended stored procedure function runs in the process space of [!INCLUDEssNoVersion].

  • The thread associated with the execution of the extended stored procedure is the same one used for the client connection.

    [!IMPORTANT]
    Before adding extended stored procedures to the server and granting execute permissions to other users, the system administrator should thoroughly review each extended stored procedure to make sure that it does not contain harmful or malicious code.

After the extended stored procedure DLL is loaded, the DLL remains loaded in the address space of the server until [!INCLUDEssNoVersion] is stopped or the administrator explicitly unloads the DLL by using DBCC DLL_name (FREE).

The extended stored procedure can be executed from [!INCLUDEtsql] as a stored procedure by using the EXECUTE statement:

EXECUTE @retval = xp_extendedProcName @param1, @param2 OUTPUT  

Parameters

@ retval
Is a return value.

@ param1
Is an input parameter.

@ param2
Is an input/output parameter.

Caution

Extended stored procedures offer performance enhancements and extend [!INCLUDEssNoVersion] functionality. However, because the extended stored procedure DLL and [!INCLUDEssNoVersion] share the same address space, a problem procedure can adversely affect [!INCLUDEssNoVersion] functioning. Although exceptions thrown by the extended stored procedure DLL are handled by [!INCLUDEssNoVersion], it is possible to damage [!INCLUDEssNoVersion] data areas. As a security precaution, only [!INCLUDEssNoVersion] system administrators can add extended stored procedures to [!INCLUDEssNoVersion]. These procedures should be thoroughly tested before they are installed.

See Also

Programming Extended Stored Procedures
Querying Extended Stored Procedures Installed in SQL Server