日期:2014-05-18  浏览次数:20546 次

问一个sql语句
现在从一个xml中更新数据

UPDATE tb SET set a=a+@a , b=b+@b ,c=(a+@a)/(b+@b) FROM #table AS e 
WHERE e.d = d and e.e=@e;


如果没有 满足 d和 e 怎么实现
insert into tb (a,b,c,d,e) values (@a,@b,@c.@d,@e) 呢



------解决方案--------------------
if not exists(select 1 from #tabel where d = @d and e = @e)
insert into tb (a,b,c,d,e) values (@a,@b,@c.@d,@e)
else
update ...
------解决方案--------------------
貌似可以IF else先判断