Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Conditional Split using SSIS

Author  Topic 

preeti_gupta
Starting Member

4 Posts

Posted - 2009-06-02 : 03:28:31
Hi

I am trying to conditionally execute a Data Flow task (DFT) based on the presence of certain data fetched by SQL query.

Logic is as follows:

If Dataexists Then
execute dataflow
Else
Perform another task
End If

I've got the code ready to go, but I'm not sure how to do this conditional branch logic.

Does anyone have any idea?

Thanks & regards
Preeti

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2009-06-02 : 08:41:59
Create a package variable (eg dataExist) INT type and set default to 0 (bool works too). Assuming "code ready to go" means your using Script Task that checks if data exists? If so, in the Script Task set "dataExist" to 1 if data exist. On your precendence constraint, set expression to @dataExist==1 (execute DFT) and set dataExist==0 (perform other task).

This is just one solution you can use. Hope this helps.
Go to Top of Page

rgombina
Constraint Violating Yak Guru

319 Posts

Posted - 2009-06-02 : 08:44:29
Oops I missed the SQL query part. Anyhow, the same logic as I mentioned except use RowCount component instead. Search this forum for RowCount solution or use Google. Thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-02 : 13:00:10
quote:
Originally posted by preeti_gupta

Hi

I am trying to conditionally execute a Data Flow task (DFT) based on the presence of certain data fetched by SQL query.

Logic is as follows:

If Dataexists Then
execute dataflow
Else
Perform another task
End If

I've got the code ready to go, but I'm not sure how to do this conditional branch logic.

Does anyone have any idea?

Thanks & regards
Preeti


by presence of data, do you mean checking if data exists in a table or not? if yes, you can use lookup transform or merge join transform with left outer for that as shown below

http://www.sqlis.com/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx


Go to Top of Page
   

- Advertisement -