Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Why does the Excel source think my query has parameters?

$
0
0

Part of my current project involves converting an Excel 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:

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$]

The "First row has column names" box in the excel connection manager is not marked.

Here's the thing: this works for most of the tabs. The one above works. However, three of them are causing the following error:

The SQL command requires 2 parameters, but the parameter mapping only has 0 parameters.

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 thw failing SQL queries are different than the ones that work:

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$]

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 24688

Trending Articles