Wednesday, 19 February 2014

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

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.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.