简体   繁体   English

使用SSIS将数据从Excel导入到SQL Server表

[英]Importing data from excel to sql server table using SSIS

I have created a basic package using excel as source and sql server database as destination. 我创建了一个基本包,使用excel作为源,使用sql server数据库作为目标。 I have inserted 5 rows in excel and they are getting populated in sql server table without any error. 我在excel中插入了5行,并且它们已填充到sql server表中而没有任何错误。 when i add 2 new rows to the excel file, i want only those two newly added rows to be added in the database table , without previous rows being populated again. 当我向excel文件中添加2个新行时,我只希望将这两个新添加的行添加到数据库表中,而不会再次填充以前的行。

Can someone please help me with this? 有人可以帮我吗?

You can try left joining the excel source with the sql table and then filtering out any rows that already have a match: 您可以尝试将excel源与sql表连接起来,然后过滤掉任何已经匹配的行:

左联接流

Notes: 笔记:

  • Excel Source is your Excel Data Excel Source是您的Excel数据
  • Sort is there because your data always needs to be sorted on your join keys when using a Merge Join 进行排序是因为使用合并联接时始终需要对联接键上的数据进行排序
  • OLE DB Source is your SQL table with existing Excel data in it. OLE DB源是其中包含现有Excel数据的SQL表。 I have an ORDER BY in my query and the IsSorted property set to TRUE so the data is already sorted coming in. 我的查询中有一个ORDER BY,IsSorted属性设置为TRUE,因此数据已经排序进来了。
  • The Merge Join is peforming a left outer join. 合并联接正在执行左外部联接。
  • The conditional Split is splitting on a condition that says ISNULL(name_of_field_from_ole_db_source) 条件拆分是在表示ISNULL(name_of_field_from_ole_db_source)的条件下拆分
  • The OLE DB Destination writes out to SQL (same table as being used in the OLE DB Source node). OLE DB目标写出到SQL(与OLE DB Source节点中使用的表相同)。

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

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