B
BillyRogers
I have some code that opens up several instances of Query analyzer and runs a
script in each of them. Is there a way for the code to monitor and know
when each script has completed?
What I'd eventually like to do is to copy the results of each script and
past it into an excel spreadsheet using VBA, but I don't want the code to
try to copy anything before the script has finished running.
' 20.sql
Shell """C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isqlw.exe""" & _
"""N:\20.sql""", vbNormalFocus
Sleep 500
SendKeys "{ENTER}", True
Sleep 500
SendKeys "{F5}", True
Sleep 500
' 21.sql
Shell """C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isqlw.exe""" & _
"""N:\21.sql""", vbNormalFocus
Sleep 500
SendKeys "{ENTER}", True
Sleep 500
SendKeys "{F5}", True
Sleep 500
' 22
Shell """C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isqlw.exe""" & _
"""N:\22.sql""", vbNormalFocus
Sleep 500
SendKeys "{ENTER}", True
Sleep 500
SendKeys "{F5}", True
Sleep 500
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003
script in each of them. Is there a way for the code to monitor and know
when each script has completed?
What I'd eventually like to do is to copy the results of each script and
past it into an excel spreadsheet using VBA, but I don't want the code to
try to copy anything before the script has finished running.
' 20.sql
Shell """C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isqlw.exe""" & _
"""N:\20.sql""", vbNormalFocus
Sleep 500
SendKeys "{ENTER}", True
Sleep 500
SendKeys "{F5}", True
Sleep 500
' 21.sql
Shell """C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isqlw.exe""" & _
"""N:\21.sql""", vbNormalFocus
Sleep 500
SendKeys "{ENTER}", True
Sleep 500
SendKeys "{F5}", True
Sleep 500
' 22
Shell """C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isqlw.exe""" & _
"""N:\22.sql""", vbNormalFocus
Sleep 500
SendKeys "{ENTER}", True
Sleep 500
SendKeys "{F5}", True
Sleep 500
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003