日期:2014-05-18  浏览次数:20428 次

sqlserver2008 执行以下语句失败是什么原因?急急 谢谢
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  


打开网页提示:禁止在.net Framework 中执行用户代码。启用‘clr enabled’配置选项。
我查了要执行上面的代码就可以了,但是执行不成功是什么原因??



------解决方案--------------------
消息 15123,级别 16,状态 1,过程 sp_configure,第 51 行
配置选项 'clr enabled ' 不存在,也可能是高级选项。

lz运行的时候是否报这个错误?

SQL code
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

------解决方案--------------------
exec sp_configure 'clr enabled ', '1 '
后面多了个空格


------解决方案--------------------
提示比较明显了吧

默认情况下 ‘clr enabled’配置选项是关闭的


用上面的代码就打开了。
------解决方案--------------------
SQL code
exec sp_configure 'show advanced options ', '1 ';   
  reconfigure;   
  go   
  exec sp_configure 'clr enabled ', '1 '   
  reconfigure;
  go
  exec sp_configure 'show advanced options ', '1 ';  
  reconfigure; 
  go

------解决方案--------------------
SQL code
  exec sp_configure 'show advanced options', '1 ';   
  go   
  reconfigure;   
  go   
  exec sp_configure 'clr enabled', '1 '   
  go   
  reconfigure; 
  go  
  exec sp_configure 'show advanced options', '1 ';   
  go   

/*配置选项 'show advanced options' 已从 0 更改为 1。请运行 RECONFIGURE 语句进行安装。
配置选项 'clr enabled' 已从 1 更改为 1。请运行 RECONFIGURE 语句进行安装。
配置选项 'show advanced options' 已从 1 更改为 1。请运行 RECONFIGURE 语句进行安装。*/

------解决方案--------------------
探讨
引用:
SQL code
exec sp_configure 'show advanced options', '1 ';
go
reconfigure;
go
exec sp_configure 'clr enabled', '1 '
go
reconfigure;
go
exec sp_configure ……



这不是一样……

------解决方案--------------------
多了空格
------解决方案--------------------
SQL code

exec sp_configure 'show advanced options', '1'

exec sp_configure 'clr enabled', '1'   
  
reconfigure with OVERRIDE

------解决方案--------------------
SQL code
exec sp_configure 'show advanced options', '1 ';   
  go   
  reconfigure;   
  go   
  exec sp_configure 'clr enabled', '1 '   
  go   
  reconfigure; 
  go  
  exec sp_configure 'show advanced options', '1 ';   
  go

------解决方案--------------------
SQL code
exec sp_configure 'show advanced options', '1';
reconfigure;
go
exec sp_configure 'clr enabled', '1';
reconfigure;
go
exec sp_configure 'show advanced options', '1';
reconfigure; 
go

------解决方案--------------------
结贴。