title: Execute Data Flow Task based on condition in SSIS
body: <p>I am very new to SSIS and I am building a package which will import files. I have a Execute SQL Task which will execute a SQL statement which will return files that needs to be imported, but the files will need to go into different tables depending on which file is being imported.</p>
  
  <p>I have 2 Data Flow Tasks in my foreach container but now based on the file type it needs to execute 1 of them</p>
  
  <p>How can I achieve this?</p>
  
  <p><img src="https://i.stack.imgur.com/TQ7g8.jpg" alt="enter image description here"></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is the query that will be executed:</p>
  
  <pre><code>SELECT ReconMedicalAidFile.fReconMedicalAidFileID,   ReconMedicalAidFile.fReconMedicalAidID, 
  ReconMedicalAids.fMedicalAidID, ReconMedicalAidFile.fFileName, 
  ReconMedicalAidFile.fFileLocation, ReconMedicalAidFile.fFileImportedDate, ReconMedicalAidFile.fNumberRecords, ReconMedicalAidFile.fUser, 
  ReconMedicalAidFile.fIsImported
  FROM ReconMedicalAidFile INNER JOIN
  ReconMedicalAids ON ReconMedicalAidFile.fReconMedicalAidID = ReconMedicalAids.fReconMedicalAidID
  WHERE (fIsImported = 0) AND (fNumberRecords = 0)
  </code></pre>
  
  <p>So the condition is based on <em>fMedicalAidID</em> </p>