Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL IF ELSE Statement. ELSE not running

$
0
0

Hello,

I have an import which I import into a staging table called stg.HandlerDirectory.  Columns are ClaimHandler and TeamTrayName.  I also have the same columns in a table called dbo.HandlerDirectory with an extra column called ID which is assigned the Identity parameter. 

I am trying to get SQL to look through the stg tbale and find matches in the dbo table.  If there are matches then I would like the dbo table updated and if there are no matches in the stg table then I would like that data inserted into the dbo table.  So far I have come up with the following code but the ELSE statement is being ignored.


Viewing all articles
Browse latest Browse all 4871

Trending Articles



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