结论:

(以插入而例)

  • 发布端的数据插入成功
  • 订阅段的数据不会插入

实验

创建一张新表

create table test_subscriber (id int, mark varchar(2),inserttime datetime)

在订阅表上创建触发器

CREATE TRIGGER [dbo].[sf_test]
ON [dbo].[t2]
AFTER INSERT
AS
BEGIN SET NOCOUNT ON; insert into test_subscriber
select c1,c2,getdate() from inserted END GO

在发布端执行满足条件的插入

如果C2的字段长度<=2,则触发器能够执行成功,那么两端的数据都能得到更新。

insert into t2 values (5,'xx')

订阅端(和发布端一致)

1> select * from t2 where c1=5
2> go
c1 c2
----------- -----------------------
5 xx (1 行受影响)
1> select * from test_subscriber
2> go
id mark inserttime
----------- ---- -----------------------
5 xx 2015-07-06 22:39:37.227 (1 行受影响)

插入使触发器执行失败的数据

insert into t2 values (6,'3xx')

发布端

1> use sql2008sbs
2> select * from t2 where c1=6
3> go
已将数据库上下文更改为 'sql2008sbs'。
c1 c2
----------- ----------------------------
6 3xx (1 行受影响)

订阅端


1> select * from t2 where c1=6
2> go
c1 c2
----------- ------------------------ (0 行受影响)

记录表

1> select * from test_subscriber where id=6
2> go
id mark inserttime
----------- ---- ----------------------- (0 行受影响)

最新文章

  1. [从产品角度学excel 04]-单元格的“衣服”
  2. 2014鸟人Birdman中文字幕文件下载
  3. Excel导出的几种方式
  4. Liferay 6.2 改造系列之二:清理不需要的Portlet
  5. Java性能提示(全)
  6. mysql一个事务中有DDL语句的binlog情况
  7. JQuery判断checkbox选中,jquery获取选中的checkbox
  8. Hibernate常见错误整理
  9. 分享一段H264视频和AAC音频的RTP封包代码
  10. 学习IT技术的技巧
  11. Android 调用系统的拍相程序进行录像
  12. C#实现动态网站伪静态,使seo更友好
  13. Linux Epoll介绍和程序实例
  14. Unity GUI 用C#和Javascript写法的区别
  15. 期望dp-hdu-4336-Card Collector
  16. Java 序列化 序列化与单例模式 [ 转载 ]
  17. Bootstrap基础学习(二)&mdash;表单
  18. Android ec环境配置
  19. Promise(interesting)
  20. Spring boot+ maven + thymeleaf + HTML 实现简单的web项目

热门文章

  1. LinearLayout练习
  2. php判断用户浏览器类型是否为微信浏览器
  3. flash背景透明兼容ie火狐
  4. android自定义控件实例(Linearlayout组合TextView和ImageView)
  5. LibLinear(SVM包)使用说明之(一)README
  6. hashmap and hashtable
  7. 直接拿来用的10个PHP代码片段
  8. Windows下LDAP服务器配置
  9. 数据结构 《5》----二叉搜索树 ( Binary Search Tree )
  10. BZOJ 3439 Kpm的MC密码