日期:2014-05-18 浏览次数:20418 次
SET IDENTITY_INSERT A ON
------解决方案--------------------
insert into A(code) select code from B where not exists ( select 1 from A where A.code = B.code ) --id为自增列,不允许有重复值出现,如果要允许的话,可以打开开关 set identity_insert table_name on insert into A ( id, code ) select id, code from B where not exists ( select 1 from A where A.code = B.code ) set identity_insert table_name off
------解决方案--------------------
你的猜测的 对的,把 * 换成具体的字段(和 A表中的字段对应即可)