XP_SENDMAIL

  • Hello,

    I am trying to create a procedure that will take a value (email addy) from a Front Page (gross I know) form that will in turn use that email address to send via sql mail.  Im trying to figure out the best way to do this... I'm used to Oracle Databases, where you can grab the :NEW (this being the value inserted) and then use it.  Is there an equivalent in SQL Server to :NEW ? I tried to write a procedure that will use XP_MAIL, but when I said USE MASTER XP_SENDMAIL ... I get a syntax error saying that I can't use the USE command in a trigger or procedure!  Can anyone helP?

    Thnx

  • The correct way to call xp_sendmail using T-Sql is:

    Exec master.dbo.xp_sendmail

    The use keyword in T-Sql is to change the database context in which you are working.  YOu cannot do that within a procedure or trigger.  When trying to use an objec tin another database you need to use th fully qualified name like in the example above.  The parts are:

    database.owner.object

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

  • duhh, can't believe I missed that.

Viewing 3 posts - 1 through 3 (of 3 total)

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