数据库是SQL SERVER, A表和B表的结构完全一样, 但两表的数据不一致.
现在想将B表的数据合并到A表, 如果主键重复的行就替换, 不重复的行就添加.
不写PB脚本, 通过SQL能实现吗? 因为有好多这样的表.
------解决方案--------------------
- SQL code
delete from A where id in (select id from B)insert into A select * from B
delete from A where id in (select id from B)insert into A select * from B