Article ID: 322884 - View products that this article applies to.
This article was previously published under Q322884
Microsoft does not support the use of Microsoft Common Language Runtime (included with the .NET Framework) for any COM Callable Wrapper or Managed Extensions for C++ in Microsoft SQL Server 2005, in Microsoft SQL Server 2000, or in Microsoft SQL Server 7.0. This limitation for support pertains directly to the use of extended stored procedures and to the use of OLE Automation for any loading of the libraries that you must load to run in the SQL Server memory space.
SQL Server 2005 and later versions host Common Language Runtime (CLR) and support procedures, functions, triggers, types, and aggregates that are written in CLR langauges. In these versions, you cannot load CLR by using extended stored proceduress or sp_OA stored procedures.
The .NET Framework assembly System.Runtime.InteropServices provides a robust environment for invoking assemblies from unmanaged code. However, there are several technical discordances between the internal implementations of CLR and SQL Server:
ThreadingTo increase performance, the CLR implements Thread Local Storage. For more information about issues that are related to the use of Thread Local Storage in extended stored procedures, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/163449/ )Use of Thread Local Storage in an extended stored procedure
190987Additionally, CLR uses only thread-based scheduling and does not support Fiber-mode scheduling. However, SQL Server can use Fiber-mode scheduling. To configure this property, use one of the following methods:
(http://support.microsoft.com/kb/190987/ )How to use extended stored procedures
MemoryThe use of extended stored procedures and OLE Automation both run in the virtual memory address space of the memory of SQL Server. The default SQL Server memory is only a fraction of the memory that SQL Server can potentially use and CLR competes with any existing implementations for these memory resources. For more information about SQL Server memory management, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/316749/ )There may not be enough virtual memory when you have a large number of databases in SQL Server
COM interoperabilityThis section specifically addresses the use of OLE Automation in SQL Server and it applies to both in-process and out-of-process COM objects. Assembly meta data for function interfaces implements a strongly-typed mechanism for any invocations.
As part of this design, the COM Callable wrapper for an assembly must use an external mechanism of mapping a ClassID to a member of a managed class. Because of this explicit mapping, there is no ability from an unmanaged perspective to establish a root list of available interfaces.
The extended stored procedure sp_oaCreate uses the IUnknown::QueryInterface interface to determine the object's support for a particular interface. The interoperability between CLR and unmanaged code relies on the IDispatch interface for implementing interfaces. Because there is no equivalent to a QueryInterface method to a CLR-based assembly, you cannot create an instance of the object.
Article ID: 322884 - Last Review: July 30, 2007 - Revision: 8.2