简体   繁体   English

使用SSIS将列记录从.CSV导出到SQL Server中的多个表

[英]Exporting column records from .CSV to multiple table in SQL Server using SSIS

I have a requirement to create a batch solution using SSIS package. 我需要使用SSIS包创建批处理解决方案。

I am new to SSIS hence exploring this to implement my scenario. 我是SSIS的新手,因此将探索它来实现我的方案。

Scenario: 场景:

  1. An external system will dump data into .CSV file on weekly basis on specific directory on server. 外部系统将每周在服务器上的特定目录下将数据转储到.CSV文件中。
  2. An SSIS package will be scheduled to run on weekly basis to read that .CSV file path on server and write those data in multiple table in SQL Server. 一个SSIS包将计划每周运行一次,以读取服务器上的.CSV文件路径并将这些数据写入SQL Server的多个表中。

Task: The source .CSV file with set of columns belong to different tables in SQL Server. 任务:具有列集的源.CSV文件属于SQL Server中的不同表。 Those column and data in that row should be mapped to specific columns in different tables. 该行中的那些列和数据应映射到不同表中的特定列。

My thought to ask community - 我想问社区-

  1. What alternatives SSIS provides which allows me to segregate each column in .CSV file and map them to different table in SQL Server? SSIS提供了哪些替代方法,使我可以隔离.CSV文件中的每一列并将它们映射到SQL Server中的不同表?
  2. In .CSV I have eleven columns. 在.CSV中,我有11列。 As per SQL table structure, those eleven columns are distributed into four separate tables. 按照SQL表结构,这十一列被分配到四个单独的表中。

I appreciate any productive advise to implement the solution. 我感谢任何有成效的建议来实施该解决方案。

UPDATE: Below things so far I setup/tried 更新:到目前为止,我已经设置/尝试了以下内容

  1. I created new SSI package successfully. 我成功创建了新的SSI包。 In Data flow so far as a source I setup the variables to read path and file name. 在数据流方面,我将变量设置为读取路径和文件名。
  2. I setup OLE DB datasource as destination and establish connection to server. 我将OLE DB数据源设置为目标并建立与服务器的连接。
  3. I believe I have reached by completing setup with .CSV as a source to read columns, but I am still exploring what would be ideal destination or how OLE DB would help to consume records in different tables. 我相信我已经完成了使用.CSV作为读取列的源代码的设置,但是我仍在探索什么是理想的目标,或者OLE DB如何帮助使用不同表中的记录。
  4. I went through Multicast and Import Columns options. 我经历了“ Multicast和“ Import Columns选项。 I understand that the Multicast is mainly used to share or output data to different destinations. 我知道Multicast主要用于共享数据或将数据输出到不同的目的地。

you can create four OLE DB destinations and using multicast you can route your data. 您可以创建四个OLE DB目标,并使用多播可以路由数据。 so basically multicast will pass all the 11 tables to all four destinations and there you can map only required column with your tables. 因此,基本上,多播会将所有11个表都传递到所有四个目的地,在那里您只能在表中映射所需的列。 Let me know if you have any confusion. 让我知道您是否有任何困惑。

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

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