Question :
The following statement sp_configure 'clr enabled'
returns:
name minimum maximum config_value run_value
clr enabled 0 1 0 0
I assume this means there are no CLR
objects; however if I execute the following statements I get these:
SELECT * FROM sys.assembly_files
SELECT * FROM sys.assembly_types
I have read that The HierarchyID type is available to CLR clients as the SqlHierarchyId data type.
.
How can it be used without having CLR
enabled and why do I need to enable it to create my own CLR
objects?
Answer :
The clr enabled
server configuration option only controls whether user assemblies can be run by the SQL Server instance.
The hierarchyid
, geometry
and geography
types are system CLR types. These are contained in system assemblies, so are available regardless of the clr enabled
setting.
Similarly, other system features that rely on CLR integration, like FORMAT
(SQL Server 2012 onward) are available even if clr enabled
is off.
If you need to manipulate hierarchyid
data in a custom CLR routine, you will need to enable user clr assemblies via this setting.
See also: Hierarchical Data (SQL Server)