The Common language runtime (CLR) feature allows you to write stored procedures/trigger/functions in .NET managed code and execute the same from SQL Server. However, in order to enable the execution of CLR code, the feature needs to be enabled first. In this blog we’ll see how to enable CLR in SQL Server.
Let’s first see how to find whether CLR feature is enabled or not.
The configuration option for CLR is “clr enabled”. The value_in_use column in above snapshot is 0, which means that CLR is not enabled. Let’s enable it as shown below
-- enable show advanced options
-- if it's disable
sp_configure 'show advanced options',1
sp_configure 'clr enabled',1
The CLR is enabled using the sp_configure stored procedure. “clr enabled” is an advanced configuration option thus “show advanced options” must be enabled. Let’s verify the status of “clr enabled” option
The value_in_use column is 1 indicating that CLR is enabled.