Using SQL Server 2008. I have a stored proc which has start and end date as input parameters for date range.
Looking for a single sql query which has a between start and end date in the where clause which can handle both cases where the dates are either both null or both have values.
I don’t want to use an IF statement.
This will be most efficient if there is an index on
mydate, since this condition is sargable and will use anIndex Seek.If there is no index, then use
IFNULLconstructs proposed by others.