Does the SQL Server
CASE statement evaluate all the
WHEN conditions or does it exit once it finds a
WHEN clause that evaluates to true? If it does go through the entire set of conditions, does that mean that the last condition evaluating to true overwrites what the first condition that evaluated to true did? For example:
SELECT CASE WHEN 1+1 = 2 THEN'YES' WHEN 1+1 = 3 THEN 'NO' WHEN 1+1 = 2 THEN 'NO' END
The results is "YES" even though the last when condition should make it evaluate to "NO". It seems that it exits once it finds the first TRUE condition. Can someone please confirm if this is the case.