ssis execute sql task issue

  • I have written an SSIS package that includes an Execute SQL Task within a ForEach Loop to send an Email if a long running query is detected.

    The issue is that the same Email is being sent three times.

    Has anyone else seen this behavior?

  • Is the Send Email Task inside the loop?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Yes

  • I'm not sure how your package is configured, but it would make sense to me that when a task is inside a loop, it can be executed multiple times.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Yes I think that is the issue but am struggling to see why, as the Email task only seems to be executed once for each pass through the loop

  • If I run the same EXEC msdb.dbo.sp_send_dbmail routine through SSMS only one Email is sent.

    If I run this through a SQL task in SSIS I get three emails. However, I checked the DBMail logs and it only says one Email was sent.

    If I run this through a SQL task in SSIS using Send Mail Task I only get one email.

    Seems like this is specific to SSIS / sp_send_dbmail?

Viewing 6 posts - 1 through 5 (of 5 total)

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