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
 SQL Server Development (2000)
 Aliasing Null Values in a recordset

Author  Topic 

stango
Starting Member

8 Posts

Posted - 2003-01-13 : 16:46:11
Sql 6.5 (i know, I know, I need to update, but it's not my decision)

I need to alias a null being returned from a query as such:

Select Name,ID,Comment
From User
Where ID = 95

This might give me the following:
Name: 'Bob' ID: 95 Comment: Null
I want the following:
Name: 'Bob' ID: 95 Comment: 'No Data'

Any Ideas?

Thanks in advance





robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-01-13 : 17:11:22
Select Name,ID, IsNull(Comment, 'No Data') AS Comment
From User
Where ID = 95


Go to Top of Page

stango
Starting Member

8 Posts

Posted - 2003-01-13 : 17:20:14
Thanks. I tried Isnull. I kept getting an error, and erroneously I assumed that i couldnt use this function in 6.5, but it was an error because I was trying IsNull(some_int_field,'No Data') instead of IsNull(some_int_field,0)

Go to Top of Page
   

- Advertisement -