Solved

SQL Null values

Posted on 2011-03-23
6
182 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 143

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 69

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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