[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

sql case

Hi,

I have the sql case statement below that works fine, however if the cn.disableReason is null then I want to return 'In-Active'

CASE candidateactive WHEN 1 THEN 'Active'  WHEN 0 THEN cn.disableReason  END  AS Status

Greatful for any help.

Thanks
0
Soluga
Asked:
Soluga
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
CASE WHEN candidateactive  IS NULL THEN 'In-Active' WHEN candidateactive  = 1 THEN 'Active'  WHEN candidateactive  = 0 THEN cn.disableReason  END  AS Status
0
 
SolugaAuthor Commented:
Thanks,
Problem is if there is a null value in cn.diablereason then it overwrites 'in-active' with Null
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I see
CASE WHEN candidateactive  IS NULL THEN 'In-Active' WHEN candidateactive  = 1 THEN 'Active'  WHEN candidateactive  = 0 THEN ISNULL( cn.disableReason, 'In-Active')  END  AS Status

Open in new window

0
 
SolugaAuthor Commented:
Excellent, thank very much.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now