Thursday, March 8, 2012

Called web page from DTS

How can I execute or access a web page from a DTS package?

Both SQL server AND website are hosted on the same server (a Dual 2.4Gz Xeon with 2Gb RAM, RAID 5 etc)

I have 2 tables in SQL server 2000 that hold orders. These need to be posted into another table at a predefined time (ie: 4:30pm) and at the same time, access a remote address (a web service) and post certain elements of the order back.

Basically, can anyone help me out on how to execute a web page from a DTS.

I do NOT want to access a DTS from a webpage, which is all I'm finding at the moment.Not a problem - solved my problem|||How did you solve your problem? Did you use the ServerHTTP object through VBScript?

David|||Create stored proc with :

exec xp_cmdshell 'c:\temp\test.vbs

Call stored proc from DTS

test.vbs should contain something like:


Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("http://localhost/yoursite/yourpage.aspx")

and then do whatever you like in 'yourpage.aspx'

Works fine for me, but then I have full control over the server. If the site is hosted with a hosting company you may have problems using xp_cmdshell due to the fact that it can pose a security problem because it can pretty much perform any command on the server.|||Why did you create the stored proc, and why did you create the vbs file? Why not just execute the vbscript within the DTS package itself?|||Note: I didn't post ALL of my code for the stored proc - I only posted the relevent part of it.

There's a lot more going on in the procedure which I haven't mentioned, which I didn't want to post.

No comments:

Post a Comment