master..xp_sendmail

  • I keep getting an error at the start of the Master..XP line. Can I not perform this function within other SQL contents

    SET @Trailer1 = (SELECT Subscriber + Relation AS CombinedCol FROM BCBSAltPCP WHERE (Subscriber LIKE 'TRA%'))

    IF Exists(SELECT Subscriber FROM BCBSAltPCP WHERE Subscriber LIKE 'TRA%')

    BEGIN

    PRINT 'The trailer File does Exist so lets grab it:'

    PRINT ' '

    INSERT INTO BCBSAltPCPTemp

    (Record_Count)

    VALUES (@Trailer1)

    END

    ELSE

    -- Send Fail Mail

    master..xp_sendmail

    @recipients = 'Brady, Kelly',

    @subject = 'ERROR: Monthly Alternate PCP Import!',

    @message = 'The trailer record was not found in the Data File VIAMBA!'

  • I beleiev it has to do with the way you call xp_sendmail. Like sp's you have to have EXEC in front for it to run.

    Try

    EXEC master..xp_sendmail

    @recipients = 'Brady, Kelly',

    @subject = 'ERROR: Monthly Alternate PCP Import!',

    @message = 'The trailer record was not found in the Data File VIAMBA!'

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

  • Thanks!

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

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