sqlsserver2008 存储过程不插入重复值

[复制链接]
查看11 | 回复3 | 2013-7-12 10:01:34 | 显示全部楼层 |阅读模式
其实写个触发器,直接把插入、更新和删除的记录按照三种类型同步表B更方便。如果仅仅只是不插入重复直接插入触发,把插入的数据插入到表B即可。...
回复

使用道具 举报

千问 | 2013-7-12 10:01:34 | 显示全部楼层
给你一个sql,你自己封装到存储过程中:insert into b(col1,col2,col3...)select col1,col2,col3from awhere not exists(select 1 from b where a.col1 = b.col1 and a.col2= b.col2 and col3 = ...
回复

使用道具 举报

千问 | 2013-7-12 10:01:34 | 显示全部楼层
insert into B select * from A where 一些条件exceptselect * from B 将语句放在job中,然后可以进行定时执行...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行