Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

merge with case

$
0
0

I need your help pls...I have a requirement in merge -

how do I handle below scenario? I know i can't put 3 matched. 

when matched and s.efforts =0 then update table1 set field1=somevalue, field2=somevalue

when matched and s.efforts <>0 and target.field1<>0 then update table1 set field1=source.somevalue, field2=target.somevalue

when matched and s.efforts <>0 and target.field1=0 then update table1 set field1=source.somevalue, field2=target.somevalue


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>