2

I have a SSIS package which look for 8 files in a pre-defined location. Using script task I am checking if any files are missing? If any files are missing then I send an email stating files are missing. Now I want to stop the current package if any files are missing after sending email task.

From the Microsoft link:

I can see I can stop the ssis package by stopping the ssis service (from the SQL Server which is running SSIS Service) what I do not want to do as I am not sure if it will start the ssis service automatically again. Also I do not have permission to see and run the packages in the ssis server and test this way.

I am not sure about how to stop using DTEXEC tool either. I would appreciate any kind of help.

Hadi
  • 36,233
  • 13
  • 65
  • 124
  • 2
    You could for example count the files and save that into a variable. Then use a worklfow constraint with an expression, and only proceed if there are eight files: https://blogs.msdn.microsoft.com/mattm/2006/11/01/conditional-constraints/ – Nick.Mc Jun 23 '16 at 23:28
  • Thank you @Nick.McDermaid I have followed the tutorial in the link and it has worked. – Masud Ahmed Jun 24 '16 at 08:27
  • If you want to document your solution in an answer you should be able to accept it. – Nick.Mc Jun 24 '16 at 11:42
  • Sorry, I tried, it is not accepting answer from me. Thanks – Masud Ahmed Jun 24 '16 at 13:47

1 Answers1

2

Just fail the container by adding code "dts.TaskResult=ScriptResults.Failure".

After that, you can add an "Failure" container (just add a container and change the green arrow to a red one" to send out the email. Once you do this, you must force a "fail" on the email container and go to the container's properties (you can just right-click and choose "Properties"). Look for "FailPackageOnFailure" and change that to "True". Hope this helps.

Jaji
  • 55
  • 5