June 28, 2005 at 8:12 am
Is it possible to call an ASP page from a stored procedure or a trigger in sql server 2000 ?
June 28, 2005 at 8:13 am
Surely possible but I will strongly advise against that. What re you trying to do exactly?
June 28, 2005 at 8:20 am
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.
June 28, 2005 at 8:37 am
I'm not expert in that domain... I'll let the others DBAs finish this one.
June 28, 2005 at 9:14 am
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.
June 28, 2005 at 9:39 am
I thaught the other experts would provide more help than that .
June 28, 2005 at 1:16 pm
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
June 29, 2005 at 6:51 am
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
June 29, 2005 at 6:58 am
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...
June 29, 2005 at 7:06 am
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
June 29, 2005 at 4:33 pm
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