SQL Server 2012: CASE statement evaluates all conditions

1128940 pts.
Tags:
SQL Server 2012
Does anyone know if SQL Server 2012 CASE statement evaluates all WHEN conditions or just exits when it finds the first TRUE condition? So basically, if it goes through all of them, then does the last condition overwrite the first condition? Thank you.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

It returns when it finds the FIRST condition that evaluates to true.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Like carlosdl said, one and done. After the first true/valid test it exits and does no further testing.
    128,175 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: