need help with null values in datediff sql query

PratikShah111
PratikShah111 used Ask the Experts™
on
in sql query while doing datediff I want to take into consideration null values too

this is what i have

    SUM(CASE WHEN DATEDIFF(day, LoadDate, StartDate) BETWEEN 0 AND 2
        THEN 1 ELSE 0 END) AS 'Testfield'

In the above scenario start date can either be some date or null. If its null I want to make it today's date.  can we do that.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
I'm thinking it should go like:
DATEDIFF(day, LoadDate, ISNULL(StartDate,GETDATE()))

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial