Solved

How to filter empty and null values on a query ?

Posted on 2009-04-01
2
3,602 Views
Last Modified: 2012-05-06
HI
I need to perform a query comparing a field agaist NULL and empty values, something like:

if ID_EMPLOYEE is not NULL or is NOT empty then....

How to do that ?

Thanks in advance
0
Comment
Question by:dimensionav
2 Comments
 
LVL 11

Expert Comment

by:N R
ID: 24041799
select isnull(ID_EMPLOYEE)
from table
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 24041927
What DB Engine?

SQL Server:

select *from SomeTable
where nullif(id_employee,'') <> ''

or

select *from SomeTable
where id_employee is not null
and len(id_employee)>0
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now