title: Arbitrary Column Count SQL Data Set (SQL Server Integration Services [SSIS])
body: <p><strong>Background:</strong></p>
  
  <p>I'm attempting to iterate a list of .sql files, execute each file, save the result of each query to a specially-named, delimited text file. Right now, I achieve this using a completely standalone C# program. I'm an SSIS novice, but I'm very good at C#. Going forward in the IT department I'll be working for, SSIS is the preferred solution, so plopping it all into a giant script action is (sadly) not the solution.</p>
  
  <p><strong>Issue:</strong></p>
  
  <p>Below is a picture of my Control Flow. </p>
  
  <p><img src="https://i.stack.imgur.com/kGcn5.png" alt="Control Flow"></p>
  
  <p>The desired effect is as follows:</p>
  
  <ol>
  <li>The Foreach loops through a folder of .sql files.</li>
  <li><p>The Load SQL task assigns the contents of the current .sql file to a variable.</p>
  
  <p>(Both of these steps work)</p></li>
  <li><p>Data Flow task:</p>
  
  <p><img src="https://i.stack.imgur.com/KClVF.png" alt="Data Flow"></p>
  
  <ol>
  <li>executes the SQL in the variable AND!</li>
  <li>saves the arbitrarily sized result to a variable or file.</li>
  </ol></li>
  <li><p>(Back to Control Flow:) Missing: Save report with a varying delimiter and varying file name.</p></li>
  <li>Upload Report executes WinSCP to grab the file and put it in n > 1 assigned location(s).</li>
  </ol>
  
  <p><strong>Question:</strong></p>
  
  <p>How do I make the data flow <strong>not care</strong> about the <strong>number of columns</strong>? For instance, Report 1 has <strong>five</strong> columns, Report 2 has <strong>50</strong>, and Report 3 has <strong>25</strong>. All of these things are OK. I don't care how many columns it has, and I really could care less about the metadata in this case.</p>
  
  <p>I can do this with C# by just saying "Here's a DataTable, fill it." SSIS apparently lacks this ability to adapt to the number of columns. Yes? No? Say screw it and just do it with a script object? What's the received wisdom on what to do here?</p>
  
  <p>If this question reveals some fundamental misunderstanding of how SSIS works, feel free to comment on that, too.</p>
  
  <p>Thanks in advance!</p>