declare
@erro_sql nvarchar(128) ----cmd 调用执行的语句
--set @erro_sql='set @erro_type=errono 001 & echo %@erro_type%>>D:\07script\testdbbak\erro.log'
set @erro_sql='D:\07script\testdbbak\1.bat'
---以下是1.bat的脚本内容
---set @erro_type=errono 001
--echo %@erro_type% >> D:\07script\testdbbak\erro.log
----以上脚本内容与set @erro_sql='set @erro_type=errono 001 & echo %@erro_type%>>D:\07script\testdbbak\erro.log'
----意思相同,但是用脚本可以但用语句就不行,很多人都没办法,那为高手能解决?set nocount on
--开启xp_cmdshell支持
exec sp_configure 'show advanced options', 1
reconfigure with override
exec sp_configure 'xp_cmdshell', 1
reconfigure with override
exec sp_configure 'show advanced options', 0
reconfigure with override
print char(13)+'------------------------'
--将报错信息输入到错误日志
exec xp_cmdshell @erro_sql
----以上脚本内容与set @erro_sql='set @erro_type=errono 001 & echo %@erro_type%>>D:\07script\testdbbak\erro.log'
----意思相同,但是用脚本可以但用语句就不行,很多人都没办法,那为高手能解决?
@erro_sql nvarchar(128) ----cmd 调用执行的语句
--set @erro_sql='set @erro_type=errono 001 & echo %@erro_type%>>D:\07script\testdbbak\erro.log'
set @erro_sql='D:\07script\testdbbak\1.bat'
---以下是1.bat的脚本内容
---set @erro_type=errono 001
--echo %@erro_type% >> D:\07script\testdbbak\erro.log
----以上脚本内容与set @erro_sql='set @erro_type=errono 001 & echo %@erro_type%>>D:\07script\testdbbak\erro.log'
----意思相同,但是用脚本可以但用语句就不行,很多人都没办法,那为高手能解决?set nocount on
--开启xp_cmdshell支持
exec sp_configure 'show advanced options', 1
reconfigure with override
exec sp_configure 'xp_cmdshell', 1
reconfigure with override
exec sp_configure 'show advanced options', 0
reconfigure with override
print char(13)+'------------------------'
--将报错信息输入到错误日志
exec xp_cmdshell @erro_sql
----以上脚本内容与set @erro_sql='set @erro_type=errono 001 & echo %@erro_type%>>D:\07script\testdbbak\erro.log'
----意思相同,但是用脚本可以但用语句就不行,很多人都没办法,那为高手能解决?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货