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
 If data is null or '' Then Data show as Not Data

Author  Topic 

vedjha
Posting Yak Master

228 Posts

Posted - 2008-07-21 : 11:03:41
If data is null or '' Then Data show as Not Data:
it works,
select case vMobile when '' then 'No Data' else vMobile end as Mobile from members

but I want also in other case when null. I write a code but not works:

select case vMobile when '' or NULL then 'No Data' else vMobile end as Mobile from members
:it gives errors


Ved Prakash Jha

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-21 : 11:05:15
select case when vMobile = '' then 'No Data' WHEN vMobile IS NULL then 'No Data' else vMobile end as Mobile
from members


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-21 : 11:05:47
SELECT COALESCE(NULLIF(vMobile,''),'No Data') as Mobile...
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-21 : 11:06:18
[code]SELECT CASE COALESCE(vMobile, '')
WHEN '' THEN 'No Data'
ELSE vMobile
END AS Mobile
FROM Members[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

vedjha
Posting Yak Master

228 Posts

Posted - 2008-07-21 : 11:09:51
Thanks ViKash. its works

Ved Prakash Jha
Go to Top of Page
   

- Advertisement -