Solved

SQL Null values

Posted on 2011-03-23
6
155 Views
Last Modified: 2012-05-11
when i try the following query it does not work.
CASE WHEN Resource.EmployedBy = NULL THEN 'UNKNOWN' ELSE Resource.EmployedBy END AS EmployedBy,

or

CASE WHEN Resource.EmployedBy  ISNULL THEN 'UNKNOWN' ELSE Resource.EmployedBy END AS EmployedBy,
0
Comment
Question by:aneilg
6 Comments
 
LVL 18

Accepted Solution

by:
Cluskitt earned 64 total points
ID: 35197677
CASE WHEN Resource.EmployedBy  IS NULL THEN 'UNKNOWN' ELSE Resource.EmployedBy END AS EmployedBy,


You have to separate IS and NULL
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 62 total points
ID: 35197711
IS NULL  should do
0
 
LVL 24

Assisted Solution

by:jimyX
jimyX earned 62 total points
ID: 35197724
You can use IsNull:
ISNULL(Resource.EmployedBy, 'UNKNOWN')
0
 
LVL 40

Assisted Solution

by:Sharath
Sharath earned 62 total points
ID: 35199709
ISNULL or COALESCE would be sufficient here.

COALESCE(Resource.EmployedBy, 'UNKNOWN')
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 36032415
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

21 Experts available now in Live!

Get 1:1 Help Now