Note: This digest from: http://blog.csdn.net/heshengfen123/article/details/3597125
The execution of user code in the. NET Framework occurs during SQL script execution. The workaround for enabling the CLR enabled configuration option is:
Execute the following script:
exec sp_configure ' show advanced options ', ' 1 ';
Go
Reconfigure
Go
exec sp_configure ' clr enabled ', ' 1 '
Go
Reconfigure
exec sp_configure ' show advanced options ', ' 1 ';
Go
Explain:
sp_configure [[@configname =] ' option_name '
[, [@configvalue =] ' value ']]
The
uses sp_configure to display or change server-level settings. To change the database-level settings, use ALTER db. To change settings that affect only the current user session, use the SET statement.
Update running configuration values
When you specify new value for option, the value is displayed in the Config_value column of the result set. This value is initially different from the value in the Run_value column, which displays the currently running configuration value. To update the run configuration values in the Run_value column, the system administrator must run RECONFIGURE or RECONFIGURE with OVERRIDE. The
RECONFIGURE and RECONFIGURE with OVERRIDE are valid for each configuration option. However, the base RECONFIGURE statement rejects any option values that are outside of a reasonable range or that could cause an option violation. For example, if the value of recovery interval is greater than 60 minutes, or if the value of affinity mask overlaps with the value of affinity I/O mask, RECONFIGURE generates an error. In contrast, RECONFIGURE with OVERRIDE accepts any option value with the correct data type and forces the reconfiguration with the specified value.
Some configuration options, such as affinity mask and recovery interval, are specified as advanced options. By default, these options cannot be viewed and changed. To make these options available, set the Show Advanced options configuration option to 1.
Use the CLR enabled option to specify whether Microsoft SQL Server can run user assemblies. The CLR enabled option provides the following values.
Value description
0
does not allow assemblies to be executed on SQL Server.
1
allows assemblies to be executed on SQL Server.
The CLR enabled option is an advanced option. If you change this setting by using the sp_configure system stored procedure, you can change the CLR enabled only if show advanced options is set to 1 o'clock. This setting takes effect immediately after the sp_configure is run. You do not need to restart the instance of SQL Server.
Note:
When you run RECONFIGURE, the running value of the CLR enabled option changes from 1 to 0, and all application domains that contain user assemblies are immediately uninstalled
SQL prohibits the execution of user code in the. NET Framework. Enable the "CLR enabled" configuration option