Enable CLR in SQL Server

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.

1_Enable CLR in SQL Server

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
GO
RECONFIGURE
GO
sp_configure 'clr enabled',1
GO
RECONFIGURE
GO

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

2_Enable CLR in SQL Server

The value_in_use column is 1 indicating that CLR is enabled.

 

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Data Platform Virtual Summit 2020

Subscribe to SQLServerGeeks YouTube channel. If you want more learning content in your inbox, subscribe to SQLServerGeeks Bulletin.

SQLServerGeeks YouTube | SQLServerGeeks Bulletin | SQLServerGeeks Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *