As most of you know, SSIS has a hard time reading metadata whenever a stored procedure with temp tables is used as an OleDbSource. Previously, this could be easily prevented by adding SET FMTONLY OFF; before the EXEC statement. The downside of this is that the stored procedure gets executed during validation and this might take a while. As of SQL 2012 we can use the WITH RESULT SETS to specify columns and their datatypes. SSIS will pick this up and all is well in SQL land.
However, I want to generate a package with BIML that uses such a stored procedure as a source and I can't get it to work. Suppose I have stored procedure called 'dbo.csp_MyCsp' that uses a temp table called '#MyTempTable' with 1 column 'ColA int'. I am trying to generate an OleDbSource with the following (similar) Biml Code:
<OleDbSource ConnectionName="MyConnection" Name="OLE_SRC Test">
<DirectInput>
EXEC dbo.csp_MyCsp
WITH RESULT SETS
(
([Col1] int)
)
</DirectInput>
</OleDbSource>
I get an error that says 'Invalid object #MyTempTable'. The weird thing is, if I open a package and paste in that code in my OleDbSource, it works without any error. I have a gut feeling that the validation step of SSIS and BIML is different.
Does any of you guys have an appropriate solution? I can't use FMTONLY OFF, since the stored procedures take some time to load and this causes a generation timeout. I am using SQL Server / SSIS 2014.
Thanks in advance!
Marvin