| title | sp_addextendedproc (Transact-SQL) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/16/2017 | ||
| ms.prod | sql-non-specified | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | c0d4b47b-a855-451e-90e5-5fb2d836ebfa | ||
| caps.latest.revision | 33 | ||
| author | BYHAM | ||
| ms.author | rickbyh | ||
| manager | jhubbard |
[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx_md]
Registers the name of a new extended stored procedure to [!INCLUDEmsCoName] [!INCLUDEssNoVersion].
Note
[!INCLUDEssNoteDepFutureAvoid] Use CLR Integration instead.
| Applies to: [!INCLUDEssNoVersion] ([!INCLUDEssKatmai] through current version). |
Transact-SQL Syntax Conventions
sp_addextendedproc [ @functname = ] 'procedure' ,
[ @dllname = ] 'dll'
[ @functname = ] 'procedure'
Is the name of the function to call within the dynamic-link library (DLL). procedure is nvarchar(517), with no default. procedure optionally can include the owner name in the form owner.function.
[ @dllname = ] 'dll'
Is the name of the DLL that contains the function. dll is varchar(255), with no default. It is recommended that you specify the complete path of the DLL.
0 (success) or 1 (failure)
None
After an extended stored procedure is created, it must be added to [!INCLUDEssNoVersion] 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 [!INCLUDEssNoVersion]. It also adds an entry in the sys.extended_procedures catalog view.
Important
Existing DLLs that were not registered with a complete path will not work after upgrading to [!INCLUDEssCurrent]. To correct the problem, use sp_dropextendedproc to unregister the DLL, and then reregister it with sp_addextendedproc, specifying the complete path.
Only members of the sysadmin fixed server role can execute sp_addextendedproc.
The following example adds the xp_hello extended stored procedure.
USE master;
GO
EXEC sp_addextendedproc xp_hello, 'c:\xp_hello.dll';
EXECUTE (Transact-SQL)
GRANT (Transact-SQL)
REVOKE (Transact-SQL)
sp_dropextendedproc (Transact-SQL)
sp_helpextendedproc (Transact-SQL)
System Stored Procedures (Transact-SQL)