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)
 Returning "NOT NULL" set

Author  Topic 

cronincoder
Yak Posting Veteran

56 Posts

Posted - 2006-02-07 : 05:48:56
I am trying to select from a column which contains some null entries, and return only those results which are "not null". Can anyone give me some idea, as I am not having any success.


Table Users

UserID
1111
2222

4444
5555

6666


select UserID
from Users
where ??


So in this example above, I want to return just(1111,2222,4444,5555,6666), and not have the two blank spaces included in the results.

Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2006-02-07 : 05:56:13
[code]
WHERE UserID IS NOT NULL
[/code]


--
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt? http://www.insidesql.de/blogs
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-07 : 09:57:26
>>the two blank spaces included in the results.
If you meant them blank than Null then

WHERE Isnull(UserID,'')<>''

Madhivanan

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

- Advertisement -