How to Enable/Disable CLR in SQL Server

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. 

Ebook Download
View all
Learn
View all