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
 Other Forums
 MS Access
 Queries

Author  Topic 

varalakshmi
Yak Posting Veteran

98 Posts

Posted - 2008-05-07 : 08:17:04
Hi,
I need to display a default value in the query result if the column has null values .
Say for a string column if it is NULL then I would display something like 'NO DATA' .
Can anyone of you suggest how I can go about this?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-07 : 08:24:22
[code]select iif(col is null, 'NO DATA', col) as col
from table[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

varalakshmi
Yak Posting Veteran

98 Posts

Posted - 2008-05-08 : 09:00:06
Thank you...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-05-08 : 09:09:21
Also you may get error if col is of INT datatype
Better do this when you show data at front end

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -