send email for output of merge join

  • Hi friends,

    I am having two tables
    1) Employee and 2) Manager.

    Both tables are on different sql server. I am combining both tables using merge join. After I want to send email to all managers which are identified using merge join. How can i do this as i don't want to insert these data anywhere?

    Thanks,
    Abhas,

  • abhas - Wednesday, November 15, 2017 3:33 AM

    Hi friends,

    I am having two tables
    1) Employee and 2) Manager.

    Both tables are on different sql server. I am combining both tables using merge join. After I want to send email to all managers which are identified using merge join. How can i do this as i don't want to insert these data anywhere?

    Thanks,
    Abhas,

    Depends on how your actually doing this, SSIS, Linked Server, OpenQuery etc.

    But generally you would build up the list of email addresses and feed that into a variable and pass it into sp_send_dbmail or a Send Mail Task.

    if you can supply more background on how your getting the data then can give a more specific answer.

  • .Thanks Anthony,
    I am fetching employee data using SP from source 1 and columns are empid,firstname,lastname
    From Manager table I am fetching EmpId,Manageremail. etc.

    I am using two sources and merging both source. I want to send mail to magers which i got the resultset after merging.

    Thanks
    Abhas

  • abhas - Wednesday, November 15, 2017 4:12 AM

    .Thanks Anthony,
    I am fetching employee data using SP from source 1 and columns are empid,firstname,lastname
    From Manager table I am fetching EmpId,Manageremail. etc.

    I am using two sources and merging both source. I want to send mail to magers which i got the resultset after merging.

    Thanks
    Abhas

    Not much to go on there.

    You detail you are on two servers, where and how are you merging?  Are you doing it in a SSIS package with two data flows and merging?  Are you using a linked server and merging on one of the servers?  Are you merging in a custom written application? etc

    Still the basic principal exists, you have your merged result set, build up a string of email addresses and pass it to sp_send_dbmail or a Send Mail Task or if its a custom app write a send mail function to do the mail sending.

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

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