执行xp_cmdshell时发生错误。。。。。。。。。。
下面的代码是把已经备份的数据库复制到局域网的机器上。
declare @cmdstr1 varchar(8000)
declare @cmdstr2 varchar(8000)
declare @path varchar(8000)
select @cmdstr1=itemvalue from config where item='backupcmd'
select @path=itemvalue from config where item='datapath'
set @cmdstr1='net use z: '+@cmdstr1
set @cmdstr2='copy '+@path+'\'+CONVERT(varchar(10), GETDATE(), 102)+' z:\'
exec master..xp_cmdshell @cmdstr1
exec master..xp_cmdshell @cmdstr2
exec master..xp_cmdshell 'net use z: /delete'
执行是出现错误:
xpsql.cpp: 错误 5 来自 CreateProcess(第 675 行) [SQLSTATE 01000]
我有试着执行
exec master..xp_cmdshell 'dir'
也是一样的错误
高手来解决一下谢了。
有其他方法实现以上功能也可以