rocketTendon
asked on
Null values when using case statement
I have the following sql:
Select sale_price,
'SaleEndDate' = CASE CONVERT(VARCHAR(12),sale_p rice)
WHEN null THEN null
WHEN '' then ''
ELSE CONVERT(VARCHAR(10), [Sale End], 120)
END
from mytable
However... the sql is still returning a value for the else statement even if the sale_price IS indeed null (the sale_price shows as null in the result set).
What am I missing?
Select sale_price,
'SaleEndDate' = CASE CONVERT(VARCHAR(12),sale_p
WHEN null THEN null
WHEN '' then ''
ELSE CONVERT(VARCHAR(10), [Sale End], 120)
END
from mytable
However... the sql is still returning a value for the else statement even if the sale_price IS indeed null (the sale_price shows as null in the result set).
What am I missing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER