Blog

How to Enable/Disable CLR in SQL Server

Sep 06, 2013 Blogs | SQL Server
We can use this option to prevent any DDL operation.

Today I am going to explain very important feature of sql server 2008. Now we have an option for Enable/Disable of CLR .

We can prevent any DDL(CREATE/DROP) operation in sql server database Just the help of this option.

sp_configure 'clr enabled', 0

GO

RECONFIGURE

GO

Run above code in sql query window.From this query we can disable clr. Now run,

create table test

(

abc varchar(10)

)

drop table test


drop table test

a msg will throw..

"Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option"

Because we have disabled clr option before. Now Run,

sp_configure 'clr enabled', 1

GO

RECONFIGURE

GO

Above query again enable your clr. Now you can perform any DDL operation. 

Ravi Shekhar

I am C# corner MVP.I am working as a Software Engineer in Barcode India in Gurgaon and having 2+ year experience in C#.NET,  ASP.NET,  SQL, WINDOWS APPLICATION, JQUERY, JAVASCRIPT,WINDOWS MO...

  • 113rank
  • 211K readers
  • 1times
COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs