dbTalk Databases Forums  

Cancel the execution of a package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Cancel the execution of a package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Eduardo Greco
 
Posts: n/a

Default Cancel the execution of a package - 08-11-2004 , 08:47 AM






Hi...
My first taks is an ActiveX. Inside it, I have a test, and depending on the
result I want to cancel the rest of the package and terminate the execution.
How to do it?
Thanks...



Reply With Quote
  #2  
Old   
Salvador Dali
 
Posts: n/a

Default RE: Cancel the execution of a package - 08-11-2004 , 03:23 PM






If condition true
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If

"Eduardo Greco" wrote:

Quote:
Hi...
My first taks is an ActiveX. Inside it, I have a test, and depending on the
result I want to cancel the rest of the package and terminate the execution.
How to do it?
Thanks...




Reply With Quote
  #3  
Old   
mtl_jf
 
Posts: n/a

Default Re: Cancel the execution of a package - 08-12-2004 , 08:38 AM



Put this in you code to make the task fail


if ( condition ???????? )then
Main = DTSStepScriptResult_DontExecuteTask
else
Main = DTSStepScriptResult_ExecuteTask
end if

And in the package properties there is a option to make fail the
package on any error, check it ...

or you can set he properties of this to fail the package when it fail
Set oPkg = DTSGlobalVariables.Parent
oPkg.Steps("DTSStep_DTSExecuteSQLTask_?????????"). FailPackageOnError =
True

Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Cancel the execution of a package - 08-12-2004 , 02:39 PM



In message <ca36fb3.0408120538.3fc372b (AT) posting (DOT) google.com>, mtl_jf
<jf_lanouette (AT) hotmail (DOT) com> writes
Quote:
Put this in you code to make the task fail


if ( condition ???????? )then
Main = DTSStepScriptResult_DontExecuteTask
else
Main = DTSStepScriptResult_ExecuteTask
end if

snip

That codes needs to go in the workflow script not the task itself.
Workflow scripts can be found by right-clicking any task, Workflow -
Properties - Options, check the box and click the button for script.

Another example of using scripts to halt, but not fail a a package-

How can I check if a file exists?
(http://www.sqldts.com/default.aspx?211)
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.