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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Case Statement with Null Value

Author  Topic 

radoslav
Starting Member

17 Posts

Posted - 2006-03-10 : 15:13:07
Hi,

I have the following statement:

select myColumn,
case mycolumn
when null then 'N/A'
else mycolumn
End as mycolumn
from (select null myColumn union all
select 'AB123') a


I shoud have in the result “N/A” for the first row - when null then 'N/A'. Instead I have null. Could anybody help with this issue?
Thanks in advance!
Rocko

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-03-10 : 15:21:56
select myColumn, columnAlias = CASE WHEN myColumn IS NULL THEN 'N/A' ELSE myColumn END
...

Tara Kizer
aka tduggan
Go to Top of Page
   

- Advertisement -