title: Why does the Excel source think my query has parameters?
body: <p>Part of my current project involves converting an Excel 2007 spreadsheet having a number of tabs into an equal number of pipe-delimited flat files using an SSIS package. I've got one data flow task that opens up the excel file and selects the names of all the tabs into and object variable. A second data flow task inside a for each loop attempts to read the first 32 columns from each tab. The excel source in the second data flow task is set up to use a sql command from a variable, and the variable is an expression that substitutes the tab name into an otherwise-constant sql statement like this:</p>
  
  <pre><code>SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17,
      F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32
  FROM [Securities Portfolio$]
  </code></pre>
  
  <p>The "First row has column names" box in the excel connection manager is not marked.</p>
  
  <p>Here's the thing: this works for most of the tabs. The one above works. However, three of them are causing the following error:</p>
  
  <pre><code>The SQL command requires 2 parameters, but the parameter mapping only has 0 parameters.
  </code></pre>
  
  <p>I've modified the package to print all of the SQL statements used in the log file. The only difference is in the tab name. None have any question marks, which is what I thought SSIS used to mark parameters. I can't figure out what causes this, or even how the failing SQL queries are different than the ones that work:</p>
  
  <pre><code>SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17,
      F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32
  FROM [Capital - Part1$]
  SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17,
      F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32
  FROM [Capital - Part2$]
  SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17,
      F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32
  FROM [Securities Sources$]
  </code></pre>
  
  <p>Any help would be appreciated.</p>