Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Best ways to cancel package execution

Posted on 2008-10-28
Last Modified: 2013-11-10
I have a package that is using a Script Task to set a package variable. If the variable doesn't get a valid value (a date) is there a command to cancel the package execution?

Question by:danburyit
  • 2
LVL 22

Expert Comment

ID: 22824639
Try use DTS events inside Script to do that.
Dts.Events.FireError(-1, "", "SSIS - @LastRunDate_Dados>@StartDate! Correct the problem and try again!", "", 0)

LVL 17

Accepted Solution

HoggZilla earned 125 total points
ID: 22825175
Since you are in the package running already, not really a way to "cancel" the package - but you can certainly stop it. I reccomend using the OnCompletion precedent and adding a constraint. In other words, instead of Green Arrow connecting the next task, use a "blue" onCompletion arrow. You could send the flow of the package to a MsgBox or just stop processing. You could also send it to a Script Task and Error the package.
Connect the green arrow between the task that assigns the variable and the next task. Right click on the Green arrow and select Edit. This will give you the Precedence Constraint Editor - picture below.
Write an expression to evaluate the variable value. This is a powerful feature, if you need specific help please ask.
Does this help?


Author Closing Comment

ID: 31510867
Of course! I forgot about that. Thank you!

Author Comment

ID: 22830534
Setting the following property in the script code can determine if the precedent constraint (outlined above) will succeed or fail.

If (My code does what I want it to) Then
End If

If it's "Failure" then the precedent constraint will stop the package execution. Only in this case you don't need to evaluate anything in the precedent constraint. Just leave it with default value.


Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Split data on commas and insert into another table in separate records 26 69
SQL Server / Update DB? 22 36
SQL R 21 24
SQL Availablity Groups List 2 7
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question