首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

小弟我在SQL的触发器里 ,如何去调用EXE

2012-02-13 
我在SQL的触发器里 ,怎么去调用EXE看了http://topic.csdn.net/u/20081219/17/760e553e-7a54-4c1f-9388-67e

我在SQL的触发器里 ,怎么去调用EXE
看了http://topic.csdn.net/u/20081219/17/760e553e-7a54-4c1f-9388-67e59ee1e621.html
的帖子
然后在查询分析器里这么写的
declare @str varchar(255)
set @str='C:\Documents and Settings\Administrator\桌面\应用程序.exe'
print @str  
exec master..xp_cmdshell @str 

运行提示错误

消息 15281,级别 16,状态 1,过程 xp_cmdshell,第 1 行
SQL Server 阻止了对组件 'xp_cmdshell' 的 过程 'sys.xp_cmdshell' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'xp_cmdshell'。有关启用 'xp_cmdshell' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。

额,谁能给个通过使用 sp_configure 启用 'xp_cmdshell'的代码,谢谢了!

[解决办法]

SQL code
--开启xp_cmdshell--SQL Server blocked access to procedure 'xp_cmdshell'sp_configure 'show advanced options', 1goreconfiguregosp_configure 'xp_cmdshell', 1goreconfigurego--开启sp_OACreate--SQL Server blocked access to procedure 'sys.sp_OACreate'sp_configure 'show advanced options', 1;goreconfigure;gosp_configure 'ole automation procedures', 1;goreconfigure;gosp_configure 'Ad Hoc Distributed Queries',1;goreconfigurego
[解决办法]
SQL code
EXEC sp_configure 'show advanced options', 1GORECONFIGUREGOEXEC sp_configure 'xp_cmdshell', 1GO
[解决办法]
SQL code
--开启xp_cmdshell--SQL Server blocked access to procedure 'xp_cmdshell'sp_configure 'show advanced options', 1goreconfiguregosp_configure 'xp_cmdshell', 1goreconfigurego--开启sp_OACreate--SQL Server blocked access to procedure 'sys.sp_OACreate'sp_configure 'show advanced options', 1;goreconfigure;gosp_configure 'ole automation procedures', 1;goreconfigure;gosp_configure 'Ad Hoc Distributed Queries',1;goreconfigurego 

热点排行