September 10, 2015 at 1:53 pm
Question in review today is Creating a Report showing the FName, LName of all Employees not Specified in a region; I would assume "No Value to be Null" Correct?
Or is there another way for me to do this?
This is what I have so far...What am I missing that this is not showing me results?
Select Firstname, Lastname, Region
From Employees
WHERE Region LIKE 'null%';
Thank you for your help.
September 10, 2015 at 2:05 pm
Your query will only return rows where the region starts by null, which is different from a NULL value.
To compare NULL values, you need to use IS NULL or IS NOT NULL. That's different from something = NULL which will never evaluate to true.
September 10, 2015 at 2:53 pm
Luis Cazares (9/10/2015)
Your query will only return rows where the region starts by null, which is different from a NULL value.To compare NULL values, you need to use IS NULL or IS NOT NULL. That's different from something = NULL which will never evaluate to true.
Never? Try setting ANSI NULLS to OFF and then trying it. NB: I do not recommend setting ANSI NULLS to OFF in general, and at some unspecified point in the future, that option will no longer be available.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
September 14, 2015 at 2:57 pm
Try this...
Select Firstname, Lastname, isnull(Region,'')
From Employees
WHERE Region = ''
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply