Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CASE

Author  Topic 

BankOfficerHere
Posting Yak Master

124 Posts

Posted - 2008-09-10 : 03:23:31
Hi I have problem here. I have results on the table:

Coaching Opportunity
Meets Expectations
Unacceptable
Blank (' ')

I want a case statement where

Coaching Opportunity = 1
Meets Expectations = 0
Unacceptable = 1
Blank (' ') = NULL

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-10 : 03:25:47
[code]case when col = 'Coaching Opportunity' then 1
when col = 'Meets Expectations' then 0
when col = 'Unacceptable' then 1
when col = '' then null
end[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-10 : 03:42:48
CASE col WHEN 'Meets Expectations' THEN 0 WHEN '' THEN NULL ELSE 1 END



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -