例如:数据库A 里面的表table1数据,insert和update数据库B里面的表table2。
以前写的是不符合条件的抛出异常,写到日志里面,语句执行就终终止了,
现在想改成不符合条件的抛出异常,写到日志里面,但是语句继续执行符合条件的,
在table2表里insert和update数据。
小白一个,各位大神,有什么方法可以实现吗。
------解决思路----------------------
用if来判断啊,像下面这样
if 条件不符合
begin
insert into 日志 select xxxx
end
else
begin
insert into 数据库B..table2 select xxxx from 数据库A..table1 where 条件
update b set b.xxxx=a.xxxx
from 数据库B..table2 b,数据库A..table1 a
where b.xxxx=a.xxxx
end