I have an SSIS package which will first run my sp_doSomething. This stored procedure will select data from several different tables and join them for possible storage into dbo.someTable. But I only want that IF the select is > 1 row of selected data.
I want to then have a precedence restraint that looks at the amount of rows my stored procedure returned.
If my row count > 1, then I want to take the results of the stored procedure and insert them into one of my tables.
Otherwise, I will record an error/send an email, or whatever.
I really don't want to run this stored procedure more then once, but that is the only way I could think to do it (Run it, count the rows. Then, run it again and insert the result).
I'm a complete TSQL/SSIS newb. So I'm sorry if this question is trivial. I can't find a good answer anywhere.
Will a #temp table work for you?
you can try this
Within the Stored Proc, write the results to a #Temp. Then Select Count(*) from the #Temp, into a variable.
Then evaluate the value of @intRows.
Create a variable with Package Scope of type Int32 and name rowcount.
Data Flow
Control Flow