I have SQL statement as follows:
SELECT ReturnDate
FROM <joins>
WHERE <conditions>
How to check if ReturnDate is not null?
You can use CASE with IS NULL (or IS NOT NULL):
SELECT CASE
WHEN ReturnDate IS NULL THEN 'It is null'
ELSE 'It is not null'
END AS IsItNull
FROM dbo.tablename ....
If you need to filter for NULL/NOT NULL values you can also use IS NOT NULL:
WHERE ReturnDate IS NOT NULL ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With