Click or drag to resize

SA0142 : Consider disabling CLR if user assemblies are not used in your environment

The topic describes the SA0142 analysis rule.


Consider disabling CLR if user assemblies are not used in your environment


The rule checks if the Common Language Runtime (CLR) option is enabled and if there are registered user assemblies in the current server. If there are no user assemblies used in your environment, consider disabling the CLR.

Note Note

The 'clr enabled' option affects only the user assemblies and specifies whether such assemblies can be run by SQL Server or not.

It is not required to enable the CLR if you are just using the built-in CLR functions like FORMAT() or PARSE(), or .NET-based types like hierarchyid, geography and geometry. The 'clr enabled' option should be enabled only if you are have and use user assemblies.

Here is how you can disable the CLR option:

 1-- 1. Enable Advanced Options
 2exec sp_configure 'show advanced options', 1;
 3reconfigure with override;
 5-- 2. Disable CLR
 6exec sp_configure 'clr enabled',0;
 7reconfigure with override;
 9-- 3. Disable Advanced Options
10exec sp_configure 'show advanced options', 1;
11reconfigure with override;


The rule has a ContextOnly scope and is applied only on current server and database schema.


Rule has no parameters.


The rule requires SQL Connection. If there is no connection provided, the rule will be skipped during analysis.


Maintenance Rules

Additional Information
See Also

Other Resources