Script Job Hanging -
07-01-2005
, 04:28 AM
Please excuse me posting this in DTS, I am guessing someone in here has
experience with scheduling DTS tasks.
I am running SQL 2000 on a 2003 server and have a problem with a SQL
Job step not finishing.
The step is an activex script (see below) and as far as I can tell it
is to do with the ServerXMLHTTP section.
The problem is that the step never finishes. If I run the script on the
server directly all is good. Is it to do with the context the the job
is running in?
Any help would be appreciated, I just hope is is not a stupid error on
my part.
BTW, how do I raise an error from this script to fail the step (stop
later steps from trying to run)?
Dim url, xmlhttp, responseText
url = "http://address/filename.ext"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
Dim lResolve, lConnect, lSend, lReceive
lResolve = 5 * 1000
lConnect = 5 * 1000
lSend = 15 * 1000
lReceive = 15 * 1000
xmlhttp.setTimeouts lResolve, lConnect, lSend, lReceive
xmlhttp.open "GET", url, false
xmlhttp.send
If xmlhttp.Status >= 400 And xmlhttp.Status <= 599 Then
responseText = "Error Occurred : " & xmlhttp.Status & " - " &
xmlhttp.statusText
Else
responseText = xmlhttp.responseText
End If
set xmlhttp = nothing
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("C:\Windows\Temp\UpdateFileList .csv",
True)
outFile.WriteLine(responseText)
outFile.Close
Set fso = nothing
Set outFile = nothing |