且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过使用SSIS将行从MySQL插入/更新到SQL Server

更新时间:2023-12-04 17:44:58

Just get rid of the lookup and conditional split all together.

在SSIS包之外,构建一个临时表,其中包含插入/更新所需的字段。

Outside of your SSIS package, build a staging table that contains the fields you need for inserts/updates.

在您的SSIS程序包中,创建一个执行以下操作的控制流:

In your SSIS Package, create a control flow that does the following:


  • 执行SQL任务以截断暂存表。

  • 数据流任务,用于将MySQL数据从源系统加载到登台表。如果您可以基于仅更改类型的过程(例如使用检查的时间戳)来执行此操作,则速度会更快。

  • 执行SQL任务以在其中执行UPDATE语句

  • 执行SQL任务,以基于目标表和登台表的查询(在目标表上使用INSERT语句)对目标表执行INSERT语句。一个不存在的地方或某个关键领域的地方)

  • Execute SQL Task to truncate the staging table.
  • Data Flow task to load the MySQL data from the source system to the staging table. If you can do this based on a "changes-only" type process, such as using a timestamp that you check, it would be faster.
  • Execute SQL Task to perform an UPDATE statement on your target table using the staging table joined to the target table.
  • Execute SQL Task to perform an INSERT statement on your target table using a query based on the target table and your staging table (with a WHERE NOT EXISTS or some such on a key fied)