declare @RunTime char(5)
declare @String char(100)
set @RunTime=left(convert(char(5),getdate(),8),2+ ':' + convert(char(2),convert(int,right(convert(char(5),getdate(),8),2) )+1,2)
set @String='at '+ @RunTime + ' /interactive ' + ' C:windowssystem32 otepad.exe'
exec ('master..xp_cmdshell "'+@String +'"')
上面的脚本是在当前时间后的1分钟增加一个任务。如果直接执行
xp_cmdshell @String 会报错,最终还是在MSDN的Community中找到了解决的办法。
Posted on 2004-09-19 21:13  Jason's WMI SQL Related Blog  阅读(1191)  评论(0编辑  收藏  举报