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 When

Author  Topic 

ann
Posting Yak Master

220 Posts

Posted - 2006-10-05 : 13:26:53
how do I use "case when" within my sql statement - I want to pull a field if not null,but if it is null, then pull another field
ex:
select casenote (if not null) (else use) satisfynote as note
thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-05 : 13:33:17
Try this:

select columnalias = case when casenote is not null then casenote else satisfynote end
from yourtable

Tara Kizer
Go to Top of Page

ann
Posting Yak Master

220 Posts

Posted - 2006-10-05 : 13:40:32
Thanks! that worked perfect, just what I wanted :)
Go to Top of Page
   

- Advertisement -