I have a table with StartDate and EndDate fields. If these values are not null I can select records that are between @StartDate AND @EndDate that are not null as well.
DECLARE @StartDate nvarchar(8)
DECLARE @EndDate nvarchar(8)
SELECT D.ID, D.StartDate, D.EndDate FROM D
(@StartDate BETWEEN D.StartDate AND D.EndDate)
(@EndDate BETWEEN D.StartDate AND D.EndDate)
(D.StartDate BETWEEN @StartDate AND @EndDate)
But how could I make the select when either @StartDate OR @EndDate Or the record values can be null?
If @StartDate OR @EndDate is null that means not interested in either startdate or enddate of the event.
If record values are null that means the event is in progress and no end date.