calling a webpage (ASP Page) from a stored procedure or trigger in sql server 2000

  • Is it possible to call an ASP page from a stored procedure or a trigger in sql server 2000 ?

     

  • Surely possible but I will strongly advise against that. What re you trying to do exactly?

  • Upon update of the certain column in the table I want to call the ASP page that will send out the email to the customer. The webpage is already built.

  • I'm not expert in that domain... I'll let the others DBAs finish this one.

  • If you only want to send a mail why use the asp page as a middle man.

    Just use something like xp_sendmail. See BOL for info.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • I thaught the other experts would provide more help than that .

  • have a look at sp_makewebtask. BTW it is a BAD idea to send emails from a trigger. Use a separate Job for that.

     


    * Noel

  • Here's one possible workaround:

     

    Read this article here.

    http://www.realworldasp.net/article.asp?article=63

     

    Then you can use xp_cmdshell to shell out to a command prompt and execute

    the file with the URL.

     

    Good luck

  • What I have done in the past is have an SP/trigger/etc write the "email" to a table in the DB, storing the TO, subject, body, etc.  I then have an ASP on the webserver that gets run at specific intervals, retrieves the records from the table, sends the email, then deletes the record.  While having SQL send emails is probably the "easiest" way, for some setups that's not an option (like mine).  We have specific security setups on what the SQL box can do and sending mail isn't one of them.  My workaround, while a bit more complex and with more overhead, seems to do the trick...

  • SQLServer SP or trigger is a server side object.

    What you want to do is call a client side object out of a server side one. And this is IMHO fundamentally incorrect. because every error on the client side (or even a response needed, like "hit any key, but there is no key called "any" on my keyboard" from an app called by xp_cmdshell) will cause your SP or trigger to hang.

    As others have already suggested you can send very nice HTML based email using xp_smtp_sendmail or tools like that without using any ASP webpages.



    Bye
    Gabor

  • Hi,

    I would do something simple like creating a VBScript that sends email (I already did it) . Then creating SQL Server job that runs this script whatever you want, either a job of the type ActiveX script or a job of the type Operating System Command and running cscript myscript.vbs (or use cscript myscript.vbs in the batch file, whatever works). In SP I would call sp_start_job. Watch job permissions.

    I selected a job versus xp_cmdshell because xp_cmdshell requires admin rights by default and many sysadmins tend not to give rights on it.

    Yelena

    Regards,Yelena Varsha

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply