While writing SSIS package to load one of my data warehouse tables, I encountered SSIS problem that took me some time to figure out. I noticed that in the dataflow task one of the OLE DB source components was not returning any data even I know that records were there. So I did some investigation and found what was causing this issue.
I found that when following conditions are met, OLE DB Source component will not return any data:
- “OLE DB Source” component is based on the SQL Query
- SQL Query contains parameters
- SQL Query contains line that starts with comments symbol “–”
Example, this query (database “Adventure Works DW”) works:
SELECT CurrencyKey
FROM dbo.DimCurrency
WHERE CurrencyKey BETWEEN ? AND ?
But this query always returns empty result set:
SELECT CurrencyKey
FROM dbo.DimCurrency
– my comments
WHERE CurrencyKey BETWEEN ? AND ?