user13231908
user13231908

Reputation: 47

Case error: An expression of non-boolean type specified in a context where a condition is expected

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

Answers (1)

eshirvana
eshirvana

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

Related Questions