dbTalk Databases Forums  

script to execute or not the next task

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


Discuss script to execute or not the next task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Miguel Canas
 
Posts: n/a

Default script to execute or not the next task - 02-05-2010 , 05:31 AM






Hello,

I'm a newbie in DTS's and Integration Services, but I need to migrate a DTS
to Integration Service but it's failing when i'm migrating the activex task
(in JScript).

I have the code below:

function Main()
{
if(DTS.Variables("APAGADOS").Value !=0)
return (DTSStepScriptResult_ExecuteTask);
else
return(DTSStepScriptResult_DontExecuteTask);
}

The previous step is a SQL Task who make a select to check if there are
results in a table then i move to the next task, and if the table is empty
then he don't execute the next task and finishes.

I create already a global variable to retrieve the count of rows of the
table.

Can anyone help me?
I hope so.

Thank you

url:http://www.ureader.com/gp/1146-1.aspx

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: script to execute or not the next task - 02-05-2010 , 10:13 AM






Miguel,
Welcome to the Forums.
(BTW, there is also a dedicated forum for SSIS)

The functionality you desire is simplicity itself for SSIS. You can
eliminate the Script task entirely.

Between the two tasks (Execute SQL that gets the row count) and the next one
(whatever is might be) you have a green line, right? Right-click on this line
and select Edit. In the Evaluation operations, select Expression and
Constraint. In the Value, select Success. In the Expression, enter something
like the following:

@APAGADOS > 0

Lastlyt, select the "Logical AND" at the bottom.

NOTE: Variable names are case sensitive.

Now, the second task will execute if:
* The first step succeeds
AND
* The value of the variable is greater than 0 (you have rows to process)

HTH
--
Todd C
MCTS SQL Server 2005


"Miguel Canas" wrote:

Quote:
Hello,

I'm a newbie in DTS's and Integration Services, but I need to migrate a DTS
to Integration Service but it's failing when i'm migrating the activex task
(in JScript).

I have the code below:

function Main()
{
if(DTS.Variables("APAGADOS").Value !=0)
return (DTSStepScriptResult_ExecuteTask);
else
return(DTSStepScriptResult_DontExecuteTask);
}

The previous step is a SQL Task who make a select to check if there are
results in a table then i move to the next task, and if the table is empty
then he don't execute the next task and finishes.

I create already a global variable to retrieve the count of rows of the
table.

Can anyone help me?
I hope so.

Thank you

url:http://www.ureader.com/gp/1146-1.aspx
.

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.