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 2005 Forums
 Transact-SQL (2005)
 alternative text for null

Author  Topic 

srk
Starting Member

4 Posts

Posted - 2008-12-23 : 01:38:33
i have this query.....

SELECT COUNT(Companytable.Serial) as counts , County.County as Country FROM Companytable left JOIN County ON Companytable.CntyCode
= County.County group by County.County order by County.County

it returns
Country Number
-------- --------
1996
An Chabhain 7
Aontroim 13
here the first record value is null in db, so it is blank here.i want to show 'Others' as the text for that field..is there any way out?

srk

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2008-12-23 : 01:58:45
Hi,

Use COALESCE(yourfield,'others')

Jai Krishna
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2008-12-23 : 02:04:29
SELECT ISNULL(COUNT(Companytable.Serial),'Others') as counts , County.County as Country FROM Companytable left JOIN County ON Companytable.CntyCode
= County.County group by County.County order by County.County
Go to Top of Page

srk
Starting Member

4 Posts

Posted - 2008-12-23 : 03:16:51
thank you...that worked.

srk
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2008-12-23 : 03:26:56
welcome
Go to Top of Page
   

- Advertisement -