Reputation: 120
I have SQL Command From Variable (In General it is a Select Statement) as a Source in DataFlow Task. Destination is .csv File.
Problem: Even though no rows is affected by SQL command Variable .csv file is generating without records. I don't want to generate the file if the select statement (from SQL command variable) populate no records.
Please advise me.
Upvotes: 0
Views: 163
Reputation: 1394
Simple procedure:
you could count the rows with a query before export, using Execute SQL Task, if the number of rows is greater than 0 then proceed with the export;
The following is a possible solution:
For counting rows can also use the task: Row Count (present in the latest SSIS versions); the Row Count transformation counts rows as they pass through a data flow and stores the final count in a variable.
I hope it help
Upvotes: 1