Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello All ,

I have below tables
Product
Id,Name,Cose

ProductMasterList
Name

and one SP
ProductSearch having parameter for productname and give outpur depend upon productname


I want to create one SSIS package which will create one excel workbook having sheets for each product and each product sheet will have data related to details of product (Id,Name,Cost)

Please guide me how I can achieve that.
Posted

1 solution

1. First Create a variable "ProductList" as Object Type.
2. Create a string variable "ProductName"
3. Get SQL Task that produces Distinct List of products that you would like to pass to SP. And assign the task result set of Full Row Set to "ProductList" variable
4. Get For Each Loop with collection as Foreach ADO Enumerator
Select "ProductList" as the "ADO Object source variable". On the variable mappings select "ProductName" with index 0.
5. Add SQL Task inside and Create Table on Excel. Also make expression for "SQL Statement Source" to get table name dynamic.. A sample expression can be :
SQL
"CREATE " + @[User::ProductName]   + "\n" +
  "("+"\n" +
"ID Nvarchar(255) " + "\n" +
"Name Nvarchar(255) " +"\n"+
"Cose Nvarchar(255) " +"\n"+
")"


6. Add DataFlow Task and set Delay Validation as true
7. Add Source OLEDB and set SQL Command as :
EXEC sp_Name ?
Now map paramter to ProductName variable.
8. Create Excel Destination and set "Data Access Mode" as "Table or view name from variable" and select ProductName variable.
Map the required columns.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900