Solved

How to filter empty and null values on a query ?

Posted on 2009-04-01
2
3,605 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query 26 68
T-SQL: New to using transactions 9 47
MS SQL Update query with connected table data 3 41
SQL - Curser to do an insert based on a select 2 14
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 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