The information in this article applies to:
SUMMARY
The Open Data Services API allows customers to write extended stored procedures to extend the functionality of SQL Server. When a user runs one of these procedures, SQL Server loads the DLL containing the code and calls the function that was specified when the extended procedure was added. This code runs within the address space of SQL Server. MORE INFORMATIONThe call to an extended stored procedure may occur in two different ways:
Because an extended stored procedure is tracked in sysobjects like any other T-SQL stored procedure, it is possible to drop the reference to the existing stored procedure and replace it with a wrapper that just calls the remote routine. If you already have a wrapper stored procedure, you can either update it to use the RPC syntax, or you can use the same method outlined below to provide an additional layer of indirection on the extended stored procedure call. For the sake of example, this article uses the xp_diskfree sample extended stored procedure that ships as part of the SQL 6.5 Programmer's Tool Kit. For parameters, you pass the drive letter for which you want to get free space information, and an OUTPUT parameter to return the result. For simplicity, this example also demonstrates having all users on the production server mapped to a single login on the remote server under which the extended procedure is invoked. You can also configure this so that the user context is preserved on the remote server; if this is desired, see the documentation on sp_addremotelogin in SQL Server Books Online for full details. The process of redirecting the call to a remote server involves removing the existing extended stored procedure entry and creating a T-SQL stored procedure with the same name and parameters. On the production server, you will need to add an entry for the remote server, and vice versa on the remote computer. The following sample code indicates the required steps. Substitute the appropriate server names for the production server (PRODSRV) and the remote server (REMOTESRV).
Note that this requires that you move the extended stored procedure DLL and any supporting files to the remote server.If the problems move with the extended procedure to the secondary server, then further debugging will be required to isolate the cause. REFERENCESThe more information, see the following articles Microsoft Knowledge Base:Q190987 INF: Extended Stored Procedures: What Everyone Should Know Q163449 INF: Use of Thread Local Storage in an Ext. Stored Procedure Additional query words: xproc sp_helpextendedproc ODS
Keywords : kbSQLServ600 kbSQLServ650 kbSQLServ700 kbCodeSnippet |
Last Reviewed: October 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |