Does lightweight pooling disable built-in CLR facilities?
-
06-01-2021 - |
Question
Running SQL Server in fibre mode (lightweight pooling) disables the use of SQL CLR:
Common language runtime (CLR) execution is not supported under lightweight pooling. Disable one of two options: "clr enabled" or "lightweight pooling". Features that rely upon CLR and that do not work properly in fiber mode include the hierarchy data type, replication, and Policy-Based Management.
On the other hand, disabling SQL CLR alone (without enabling lightweight pooling) does not disable the built-in CLR types like geometry
, and geography
(though hierarchyid
is mentioned above), as shown in How can "HierarchyID" type work when "CLR" is disabled?
Now some new language features rely on the CLR, for example the FORMAT
function:
FORMAT relies on the presence of the .NET Framework Common Language Runtime (CLR).
Does running SQL Server in fibre mode disable the FORMAT
function and/or using the CLR types?
Solution
Yes.
When running in fibre mode, everything that needs the CLR is unavailable.
For example, both:
SELECT FORMAT(GETDATE(), N'd', N'en-us');
and:
DECLARE @g geometry;
SELECT @g;
...return the (slightly misleading) error message:
Msg 5846, Level 16, State 2, Line 13
Common language runtime (CLR) execution is not supported under lightweight pooling.
Disable one of two options: "clr enabled" or "lightweight pooling".
It is the lightweight pooling that is the problem, no setting of the clr enabled
option will allow CLR execution of any kind under lightweight pooling.