Reputation: 315
im using CASE WHEN to read data before updating it(later on, once my select CASE WHEN is fully functional) However, im not getting the right result.
SELECT CASE WHEN INCIDENT_RK = 52080
THEN NULL
ELSE CASE_RK
END AS CASE_RK
FROM [casemgmt4].[ecmdb4].[INCIDENT_LIVE]
Just one record with the same SELECT statement
However, it makes more than 120 rows to NULL More than 120 records with the same SELECT statement
Can anyone tell me if I have mistake in code?
Upvotes: 0
Views: 151
Reputation: 51581
If it is true that only one record has INCIDENT_RK = 52080
then the other 119 must be records were CASE_RK
was NULL
. Check for yourself.
SELECT CASE WHEN (INCIDENT_RK = 52080) THEN NULL
ELSE CASE_RK
END AS CASE_RK_NEW
, CASE_RK as CASE_RK_OLD
FROM [casemgmt4].[ecmdb4].[INCIDENT_LIVE]
Upvotes: 2