Running an ASP page from T-SQL | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Running an ASP page from T-SQL

Can someone please tell me if it is possible to run an ASP page from T-SQL? Basically what I am dong is: I have an ASP page that expects one parameter and then prepares an XML command string and forwards it to a device via http. Can I do that from T-SQL without launching a web browser? Thanks. [:0]
I wonder if there is method to do it from SQL Server
Is this helpful? master..xp_cmdShell ‘ping YourURL’ Madhivanan Failing to plan is Planning to fail
Thanks Madhivanan. I tried to use xp_cmdshell to run iexplore.exe and pass the web address with the parameter. Everytime I try that the script freezes up. I think think may work if I know how to run iexplore.exe in silent mode using xp_cmdshell. Any idea is very appreciated. Thanks-
Isn’t it better to write this in a langauge that can handle this better like vbscript. You really don’t want to run internet explorer from within a sql process. In T-SQL insert a flag in a queue table or something, have a standard vbscript scheduled that checks this table and calls the ASP page.
You can’t use xp_cmdshell to launch an app that requires any kind of "user interaction". I’m not familiar with DTS, but I think you can use a DTS package with a WIN32 process task (I think it is named so). —
Frank Kalis
SQL Server MVP

I think writing a DTS package and using the ActiveX task to write VB script is the perfect solutions. However it is failing when I try to send the XML command. I am not a VB guru neither XML, I would appreciate anyone who can give me a link to a site that gives examples of such things, like sending an XML commad to a device using VBscripts. Thanks.
You can instantiate the IE’s COM interface from within SQL using sp_OACreate. example: CREATE PROCEDURE xp_cdosendmail(
@Address varchar(255),
@Message varchar(8000),
@Subject varchar(255),
@From varchar(255) = ‘[email protected]‘) AS DECLARE @CDO int, @OLEResult int, @Out int –Create CDONTS.NewMail object
EXECUTE @OLEResult = sp_OACreate ‘CDONTS.NewMail’, @CDO OUT
IF @OLEResult <> 0 PRINT ‘CDONTS.NewMail’
EXECUTE @OLEResult = sp_OASetProperty @CDO, ‘BodyFormat’, 0
EXECUTE @OLEResult = sp_OASetProperty @CDO, ‘MailFormat’, 0 –Call Send method of the object
execute @OLEResult = sp_OAMethod @CDO, ‘Send’, Null, @From, @Address, @Subject, @Message, 1 –0 is low 1 is normal
IF @OLEResult <> 0 PRINT ‘Send’ –Destroy CDO
EXECUTE @OLEResult = sp_OADestroy @CDO return @OLEResult GO