Is there a opposite function to ISNULL in sql server? To do Is not null?

Bobby picture Bobby · Oct 8, 2013 · Viewed 65.7k times · Source

I have this code in my select statement

ISNULL(a.PolicySignedDateTime,aq.Amount) AS 'Signed Premium',

But I want to see if "a.PolicySignedDateTime" is not null. Is there a easy function to do this which does not involve using a "if" statement?

Cheers guys

Answer

Szymon picture Szymon · Oct 8, 2013

You have to use CASE

SELECT CASE WHEN Field IS NOT NULL
    THEN 'something'
    ELSE 'something else'
END