Friday, March 9, 2012

Request a web page from SQL Server

Hi,

I want to request a webpage from sql server every hour.

I tried to make a job which contains a single ActiveX step.
I select VBScript and type

Dim Http
Set Http = CreateObject("Microsoft.XMLHTTP")
Http.Open "GET", "http://localhost/updater_watch.aspx", False
Http.Send
Set Http = Nothing

I set a schedule and on every execution I get an error in the event log.

Event Type: Warning
Event Source: SQLSERVERAGENT
Event Category: Job Engine
Event ID: 208
Date: 8/11/2003
Time: 8:15:00 PM
User: N/A
Computer: NEXUS
Description:
SQL Server Scheduled Job 'updater' (0x444D7F519E70534C9EF81B1570382AEE) - Status: Failed - Invoked on: 2003-08-11 20:15:00 - Message: The job failed. The Job was invoked by Schedule 1 (s1). The last step to run was step 1 (invoke).

Is this the right way to do this task? When I execute the VBScript without the sql server, it runs without a problem.

Thanks, PanayotWhy not set it up as a ongoing job?|||Thanks for the reply garrydawkins,

that is what I have done.
I open eterprise manager and go to management-sql server agent-jobs-new job.
Then create the job, set a its type to activex, make a schedule to execute it every hour. it executes but exits with error. I suspect that it cannot create the xmlhttp object properly in the VB code.

If I only leave two simple statements:

dim somevar
set somevar = nothing

then the job exits with success.

No comments:

Post a Comment