August 15, 2007 at 12:17 pm
I have a batch file that starts a sequence of Executibles (for Great Plains). I would like to be able to use DTS to start the BAT file. I would rather use this than the windows scheduler. Then I can keep all scheduled jobs in the SQL Server Agent. Does anyone have an idea of how to do this. I tried the XP_cmdshell and nothing happend just sat there.
August 15, 2007 at 5:36 pm
Do you have the proper permissions to execute xp_cmdshell?
I added this line to an Execute SQL task and it worked:
EXEC master.dbo.xp_cmdshell 'START c:\test.bat'
Make sure the last command in your batch file is EXIT, otherwise xp_cmdshell will sit there indefinately waiting for a return value from the command that was executed. (You'd have to log on to your SQL Server and kill any CMD.EXE processes running under Task Manager to get the return value.)
Something like this in a
n Active X Script task works too:
Function Main()
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run("c:\test.bat")
Set objShell = Nothing
Main = DTSTaskExecResult_Success
End Function
August 16, 2007 at 1:52 am
Is this the only step in the DTS package? If so, why not start the bat file using a specific step in a job using the Operating System Command (CmdExec) type?
J
August 16, 2007 at 3:01 am
If this is in SQL Server 2000 then there is a task called "Execute Process Task" in the DTS designer. In its properties you can paste a link to a bat/exe file into the "Win32 process" field.
I hope it helps. In 2005 I haven't tried it.
August 17, 2007 at 7:42 am
First,
I just wanted to thank you all for your responses. I really appreciate it. It eases my stress knowing there is help out there.
I tried the Active X and it works perfectly. I will try the others when I have time. Again thank you all.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply