Skip to content

Latest commit

 

History

History
89 lines (62 loc) · 3.62 KB

sp-addextendedproc-transact-sql.md

File metadata and controls

89 lines (62 loc) · 3.62 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_addextendedproc (Transact-SQL)
Registers the name of a new extended stored procedure to SQL Server.
markingmyname
maghan
randolphwest
08/21/2024
sql
system-objects
reference
sp_addextendedproc_TSQL
sp_addextendedproc
sp_addextendedproc
TSQL

sp_addextendedproc (Transact-SQL)

[!INCLUDE SQL Server]

Registers the name of a new extended stored procedure to [!INCLUDE ssNoVersion].

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_addextendedproc
    [ @functname = ] N'functname'
    , [ @dllname = ] 'dllname'
[ ; ]

Arguments

[ @functname = ] N'functname'

The name of the function to call within the dynamic-link library (DLL). @functname is nvarchar(517), with no default. @functname optionally can include the owner name in the form <owner.function>.

[ @dllname = ] 'dllname'

The name of the DLL that contains the function. @dllname is varchar(255), with no default. You should specify the complete path of the DLL.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

After an extended stored procedure is created, it must be added to [!INCLUDE ssNoVersion] by using sp_addextendedproc. For more information, see Adding an Extended Stored Procedure to SQL Server.

This procedure can be run only in the master database. To execute an extended stored procedure from a database other than master, qualify the name of the extended stored procedure with master.

sp_addextendedproc adds entries to the sys.objects catalog view, registering the name of the new extended stored procedure with [!INCLUDE ssNoVersion]. It also adds an entry in the sys.extended_procedures catalog view.

Important

Existing DLLs that aren't registered with a complete path don't work after upgrading to [!INCLUDE ssnoversion-md]. To correct the problem, use sp_dropextendedproc to unregister the DLL, and then reregister it with sp_addextendedproc, specifying the complete path.

Permissions

Only members of the sysadmin fixed server role can execute sp_addextendedproc.

Examples

The following example adds the xp_hello extended stored procedure.

USE master;
GO
EXEC sp_addextendedproc xp_hello, 'c:\xp_hello.dll';

Related content