BETWEEN dates

I've got a really strange issue

I am bringing back a set of data which is between two dates

    ppr.ReferralEndDate between @startdate and @EndDate

Now, when I set it this way:

set @enddate = '20150331 23:59:59.999'

The two rows with End Dates on 20150331 are missing, but when I set it this way:

set @enddate = '20150401 00:00:00.000'

I do...

However, the two rows end dates are both before midnight on the 31st... which is weird

Can anyone explain this?

Your declare of the variable is probably of type date and not datetime?

1 Like

Correct....oh such a simple solution, will remember that one!

:blush: