How to check a column containing null value using SQL's in Spanner Database. I have both String and Timestamp columns types. When I try to write the below query I am always getting value in the column as result .If the column is null its prints like null;
select
case when t.locked_by IS null then 'A'
else t.locked_by
end
from Temp1 t where name='test2'
I can't really see anything wrong with the query, and I cannot reproduce the issue myself. But you could try to use COALESCE
instead of the CASE WHEN
operator:
SELECT COALESCE(t.locked_by, 'A')
FROM Temp1 t
WHERE name='test2'