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.
Author |
Topic |
preeti_gupta
Starting Member
4 Posts |
Posted - 2009-06-02 : 03:28:31
|
HiI 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 dataflowElse Perform another taskEnd IfI'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 & regardsPreeti |
|
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. |
 |
|
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. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-02 : 13:00:10
|
quote: Originally posted by preeti_gupta HiI 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 dataflowElse Perform another taskEnd IfI'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 & regardsPreeti
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 belowhttp://www.sqlis.com/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx |
 |
|
|
|
|