Using xp_mail

  • Hi everyone. I've already posted a similar topic, but still I have problems.

    I create a job in the Enterprise Manager, Management. I use the following step :

    Catagory : Uncategorized (local).

    First and last job is a query :

    Exec sb.dbo.xp_sendmail

    @recipients = 'jeffrey'(or I've used my emailadres),

    @query = 'Select nomat, nofact from ventven where codaff = '''

    This job simply doesn't work !!! How ? Why ?

    If I test this job in the query analyzer I've the next result :

    Server: Msg 2812, Level 16, State 62, Line 1

    Could not find stored procedure 'sb.dbo.xp_sendmail'.

    Help me automate !!!!

    Thx

    Jeffrey

    JV


    JV

  • I assume sb is the DB you want to query, also master is where xp's live and you have to reference them that way so try.

    Exec master.dbo.xp_sendmail

    @recipients = 'jeffrey'(or I've used my emailadres),

    @query = 'Select nomat, nofact from sb.dbo.ventven where codaff = '''

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Don't you need to start a mail session also? Maybe this is more of a question then an answer.

    Something like this.

    Exec master.dbo.xp_startmail

    Go

    Exec master.dbo.xp_sendmail

    @recipients = 'jeffrey'(or I've used my emailadres),

    @query = 'Select nomat, nofact from sb.dbo.ventven where codaff = '''

    Go

    exec master.dbo.xp_stopmail

    Go

    Thanks,

    Doug

    BTW...

    Thanks Antares686 for the help the other day on my DateAdd function. Worked great!

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

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