[英]Import multiple Excel files into SQL Server 2008 R2 using SSIS Packages?
I have to insert data into two tables from two different excel sheets using SSIS packges. 我必须使用SSIS包从两个不同的Excel工作表中将数据插入到两个表中。
So, please some one tell me How to import multiple Excel files into SQL Server 2008 R2 using SSIS Packages? 那么,请有人告诉我如何使用SSIS包将多个Excel文件导入SQL Server 2008 R2?
Use Foreach Loop Container --> Foreach File Enumerator. 使用Foreach循环容器 - > Foreach文件枚举器。 Then put your Data Flow in Foreach Loop Container.
然后将您的数据流放在Foreach循环容器中。 Table structure and sheet name have to be equal in every Excel file.
每个Excel文件中的表结构和工作表名称必须相同。
Here is nice tutorial: http://bi-polar23.blogspot.com/2007/08/loading-multiple-excel-files-with-ssis.html 这是一个很好的教程: http : //bi-polar23.blogspot.com/2007/08/loading-multiple-excel-files-with-ssis.html
since you have only 2 excel files and only two tables I don't see why use a foreach loop. 因为你只有2个excel文件,只有两个表我不明白为什么要使用foreach循环。 Just follow this link and do it directly
只需点击此链接即可直接进行操作
If you need to insert from both excel files to both databases you can use a multicast component to create a copy of a dataset 如果需要从两个excel文件插入到两个数据库,则可以使用多播组件创建数据集的副本
You can create and use variables to hold Excel file path, then implement the package within a for-each-loop container to loop trough each excel files in the folder. 您可以创建和使用变量来保存Excel文件路径,然后在for-each-loop容器中实现该包,以循环遍历文件夹中的每个excel文件。 Make sure that the files are having similar data format and same extension.
确保文件具有相似的数据格式和相同的扩展名。 Create an integration service project in Visual Studio and follow the steps below:
在Visual Studio中创建集成服务项目,并按照以下步骤操作:
Right Click on canvas and add Variable say "FilePath" and set type as String 右键单击画布并添加Variable say“FilePath”并将type设置为String
Drag a for-each loop to canvas 将for-each循环拖到画布上
Ref: https://www.encorebusiness.com/blog/import-data-from-multiple-excel-files-sql-ssis/ 参考: https : //www.encorebusiness.com/blog/import-data-from-multiple-excel-files-sql-ssis/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.