Link to home
Start Free TrialLog in
Avatar of rocketTendon
rocketTendon

asked on

Null values when using case statement

I have the following sql:

Select sale_price,
'SaleEndDate' = CASE CONVERT(VARCHAR(12),sale_price)
         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
Avatar of rafrancisco
rafrancisco

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rocketTendon
rocketTendon

ASKER

Thanks... should have tried that... didn't even think about that.