[译]Stairway to Integration Services Level 5 - 增量删除数据
在 dbo.Contact中添加一行记录
Use AdventureWorks
go
Insert Into dbo.Contact
(FirstName, MiddleName, LastName, Email)
Values
('Andy', 'Ray', 'Leonard', 'andy.leonard@gmail.com')
把 Data Flow Task 改名为 “Insert and Update Rows.” 然后再拖一个 Data Flow task 并改名为 “Delete Rows”如下图:
图 3
打开 Delete Rows,添加 OLE DB Source ,配置如下:
- OLE DB Connection Manager: (local).AdventureWorks
- Data Access Mode: Table or view
- Name of the table or view: dbo.Contact

图 4
我们使用 dbo.Contact 作为源,在添加一个 Lookup Transformation 来判断缺少的记录. :

图 5
打开,把“Specify how to handle rows with no matching entries” 设定为Redirect rows to no match output”:

图 6
在 Connection 页, “ 选择 “(local).AdventureWorks”. 选择“Use results of an SQL query” 选项,并且输入以下T-SQL语句 :
Select EmailAddress As Email
From Person.Contact
Column界面,还是通过Email来匹配:
图 7
拖个 OLE DB Destination ,然后连接Lookup, 选择提示框选择 Lookup No Match Output :

图 8
把 OLE DB Destination 改名为 “StageDeletes” 双击打开.设置和之前一样. 建立表格如下:
CREATE TABLE [StageDeletes] (
[FirstName] nvarchar(50),
[LastName] nvarchar(50),
[Email] nvarchar(50),
[MiddleName] nvarchar(50)
)
点开Mappings.已经自动匹配 .:
图 9
和之前一样,我们要放个Execute SQL Task 处理删除动作:

图 10
打开 Execute SQL Task Editor 设置属性如下:
- Name: Apply Staged Deletes
- Connection: (local).AdventureWorks
- SQLStatement: (这里原文应该写错了.不是 Person.Contact,而是 dbo.Contact)
Delete src
From Person.Contact src
Join StageDeletes stage
On stage.Email = src.EmailAddress
右击Apply Staged Deletes 然后点 Execute Task执行单元测试:
图 11
最后在 Truncate StageUpdates 里面加上StageDeletes的Truncate语句 :
Truncate Table StageDeletes
图 12
执行这个SSIS包:

Figure 13
检查 Delete Rows Data Flow Task:

图 14
看来没什么问题. 在SQL中执行语句来验证下. (原文又写错了…应该是dbo.Contact) :
Use AdventureWorks
go
Select Count(*) As RecCount
From dbo.Contact
Where FirstName = 'Andy'
And LastName = 'Leonard'
原文地址: http://www.sqlservercentral.com/articles/Integration+Services+(SSIS)/76395/
资源: 项目文件
[译]Stairway to Integration Services Level 5 - 增量删除数据的更多相关文章
- [译]Stairway to Integration Services Level 4 - 增量更新数据
在本文中, 我们说下增量更新数据:即将数据源中更新了的数据替换掉目标表中对应的数据. 更新代码 操作之前我们先把目标表e (dbo.Contact). 的数据改掉 Use AdventureWorks ...
- [译]Stairway to Integration Services Level 3 - 增量导入数据
让我们打开之前的项目:My_First_SSIS_Project_After_Step_2.zip 之前项目中我们已经向dbo.contact 导入了19972行,如果再次执行包会重复导入,让我们来解 ...
- [译]Stairway to Integration Services Level 16 – Flexible Source Locations (多文件导入)
介绍 在本文中我们将利用SSIS参数,变量 以及 Foreach Loop Container 从多个源动态导入数据. 开始前我们先下载一些数据.WeatherData_Dec08_Apr09.zip ...
- [译]Stairway to Integration Services Level 12 - 高级日志配置
介绍 本文中,我们将结合之前学习的时间冒泡,日志记录,以及复制模型.建立一个自定义的SSIS包日志模型. SSIS Task事件回顾 Reviewing SSIS Task Events 在做实 ...
- [译]Stairway to Integration Services Level 9 - Control Flow Task Errors
介绍 在本文中,我们会实验 MaximumErrorCount和ForceExecutioResult 故障容差属性,并且还要学习Control Flow task errors, event han ...
- [译]Stairway to Integration Services Level 18 – 部署和执行
介绍 在本文中,我们要创建一个SSIS Catalog 实例,部署我们的项目,并且运行 weather data loader 包. SSIS 2012 部署模型 SSIS 2012 Deploy ...
- [译]Stairway to Integration Services Level 6 - SSIS 工作流管理基础
简介 在之前的章节中,我们学习了增量载入数据. 本文中.我们通过优先约束(Precedence Constraints)来管理SSIS的工作流. 添加一个SSIS包 图 1 将新建的Package1. ...
- [译]Stairway to Integration Services Level 15 – SSIS 参数回顾
介绍 在本文中我们会研究SSIS变量姐妹: SSIS 变量. 我们会演示参数配置,通过包参数管理动态属性值,然后会演示SSIS包执行的时候参数怎么被配置的. SSIS Parameters 101 S ...
- [译]Stairway to Integration Services Level 13 - SSIS 变量回顾
介绍 在前一篇中我们组合了已经学过的事件冒泡 event bubbling, 日志记录 logging, 和父子模型 Parent-Child pattern 建立了自定义的SSIS包日志记录. 本文 ...
随机推荐
- character-RNN模型介绍以及代码解析
RNN是一个很有意思的模型.早在20年前就有学者发现了它强大的时序记忆能力,另外学术界以证实RNN模型属于Turning-Complete,即理论上可以模拟任何函数.但实际运作上,一开始由于vanis ...
- clear:both后margin-top不起作用
如: <div style="float:left;">float:left</div> <div style="clear:both;ma ...
- 如何使用 Android Studio 的 git hub 功能
How to use GitHub with Android Studio This article will explain how to use GitHub with Android Studi ...
- Http请求 post get
package com.sprucetec.tms.utils; import org.slf4j.Logger;import org.slf4j.LoggerFactory; import java ...
- 自己动手实现getElementsByClassName
看了一句话,我们都是搬运工,github的搬运工,下面这代码搬运来自各个地方,最后成型. var classCache = {}; function getElementsByClassName(cl ...
- rsyslog 走tcp通讯配置
发送端: local5.* @@192.168.32.76 front-end:/usr/local/nginx/logs# cat /etc/rsyslog.conf 日志服务器端配置: # Pro ...
- HDU 5019 Revenge of GCD
题解:筛出约数,然后计算即可. #include <cstdio> #include <algorithm> typedef long long LL; LL a1[10000 ...
- Ubuntu下远程访问MySQL数据库
MySQL远程访问的命令 格式: mysql -h主机地址 -u用户名 -p用户密码 jack@jack:~$ mysql -h192.168.5.154 -usaledata -pEnter pas ...
- 网页在Safari快速滚动和回弹的原理: -webkit-overflow-scrolling : touch;的实现
现在很多for Mobile的H5网页内都有快速滚动和回弹的效果,看上去和原生app的效率都有得一拼. 要实现这个效果很简单,只需要加一行css代码即可: -webkit-overflow-scrol ...
- JAVA词汇大全
JAVA词汇大全 A B C D E F H I J L M O P R S T U V W A Abstract Window Toolkit(AWT)抽象窗体工具集 一个用本地图形组件实现的 ...
