July 22, 2008 at 9:22 am
Hi,
Please help with the following.
I have an Execute Process Task calling a bat file, (File1) with arguments, in a loop. I want SSIS to wait for it to complete before going to the next value in the loop. It doesn't seem to do that.
The File1 that SSIS calls makes a call to rcmd to run File2. I added start /WAIT to File1 but that didn't help. With this, SSIS runs the File2 sucessfully for first iteration of the loop and then hangs. Also, a DOS window gets opened to show what it is executing from File2, even though I have @ECHO OFF in File2. Until I close the DOS window the loop doesn't continue.
File1:
@ECHO OFF
start /WAIT rcmd \\abcdetl01 E:\FOlDER\SFDC\EXTRACT.bat %1 %2 %3 %4 %5
File2:
CAlls an exe to run and do stuff.
Thanks,
Juls
July 24, 2008 at 10:11 am
I've added sql task that executes WAITFOR DELAY '0:02' --2 minute wait
between steps. its not the best, but has worked. i just never searched for a real solution, which would be to receive a response that one task has completed
July 24, 2008 at 11:42 am
I'm not doing anything special and my ProccessTasks wait for the batch file to finish.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
April 24, 2009 at 8:24 am
i've also encountered this problem. my solution was to check to see if there was an open connection to the program that the BAT file was calling.
for example, my BAT file called a process "abcd.exe". if this process was already open, my T-sql would not wait until the processed actually finished, thus making my entire script fail.
now, i check to see if abcd.exe is open before calling my BAT file. if its not open, a new connection is created and sql will wait until the process finishes before continuing.
May 22, 2009 at 5:33 am
Use this Code to run the bat job where xxxxxxxxx.bat is you bat file:
Dim procID As Integer
Dim newProc As Diagnostics.Process
newProc = Diagnostics.Process.Start("C:\ftp\xxxxxxxxx.bat")
procID = newProc.Id
newProc.WaitForExit()
Dim procEC As Integer = -1
If newProc.HasExited Then
procEC = newProc.ExitCode
End If
MsgBox("Process with ID " & CStr(procID) & _
" terminated with exit code " & CStr(procEC))
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply