Reputation: 47
I am trying an merge operation and insert in specific column the following strings based on case conditions in SQL Server. However, I am getting:
an expression of non-boolean type specified in a context where a condition is expected
I am getting error on the third WHEN CASE.
CASE
WHEN SOURCE.oID NOT NULL THEN 'Type A'
WHEN SOURCE.bID IS NULL THEN 'Type B'
WHEN SOURCE.oID AND SOURCE.bID IS NOT NULL THEN 'Type C'
ELSE 'null'
END
Upvotes: 0
Views: 924
Reputation: 24603
third line is missing the first condition criteria should be something like this:
WHEN SOURCE.oID IS NULL AND SOURCE.bID IS NOT NULL THEN 'Type C'
Upvotes: 1