简体   繁体   English

使用SSIS基于数据表的动态Excel WorkSheets

[英]Dynamic Excel WorkSheets based on data tables using SSIS

Trying to create dynamic Excel WorkSheets based on data tables using SSIS. 尝试使用SSIS基于数据表创建动态Excel WorkSheets。

Each Excel worksheet would represent a State and State work sheet would have different rows and columns. 每个Excel工作表将代表一个State,而State工作表将具有不同的行和列。

For instance: AL - Alabama WorkSheet 例如:AL-阿拉巴马州WorkSheet

A/C No Col1 Col2 Col3 ..... Col 39 (there are 39 columns) A / C编号Col1 Col2 Col3 ..... Col 39(共有39列)

1000 123 ABC 39j........49sd 1000 123 ABC 39j ........ 49sd
2000 123 ABC 39j........49sd 2000 123 ABC 39j ........ 49sd

FL - Florida WorkSheet 佛罗里达-佛罗里达工作表

A/C No Col1 Col2 Col3 ..... Col 39 A / C编号Col1 Col2 Col3 ..... Col 39

1000 123 ABC 39j........49sd 1000 123 ABC 39j ........ 49sd
2000 123 ABC 39j........49sd 2000 123 ABC 39j ........ 49sd

540K rows are involved so each worksheet would have around 54K records. 涉及540K行,因此每个工作表将具有约54K记录。

Let me know what's the best approach 让我知道什么是最好的方法

This sounds like a parameterized SSIS package, to me. 对我来说,这听起来像一个参数化的SSIS包。 You can do this by creating variables to hold the parts of the data flow that will change (the state to search for, the name and path of the destination file) and setting those properties on the Excel and ADO.NET connection managers using expressions . 您可以通过创建变量来保存将要更改的数据流部分(要搜索的状态,目标文件的名称和路径),然后使用表达式在Excel和ADO.NET连接管理器上设置这些属性,来实现此目的。 At run time, you'd change the values of the variables and run the package. 在运行时,您将更改变量的值并运行包。

Now, that's a very high-level summary. 现在,这是一个非常高级的摘要。 Going through it step by step would be too big a task for this setting, but here's an article that goes into how to do it in reverse (flat file to SQL). 对于此设置,逐步进行操作将是一项艰巨的任务,但是这里有一篇文章介绍了如何反向执行(将平面文件转换为SQL)。 The basic concepts are the same, though, and, in particular, this article shows how to set expressions and variables in your package. 但是,基本概念是相同的,尤其是本文将介绍如何在包中设置表达式和变量。

Best way to do anything in SSIS is script task. 在SSIS中执行任何操作的最佳方法是脚本任务。

Use Interop services for excel in Script task and create workbooks before dumping the data. 在转储数据之前,将Interop服务用于Script任务中的excel并创建工作簿。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM