Here is what I am trying to do:
declare @dateBegin as datetime, @dateEnd as datetime
declare @column as varchar(30), @order as varchar(4)
set @dateBegin = null
set @dateEnd = null
set @column = 'created'
set @order = 'DESC'
(@dateBegin is null or startTime >= @dateBegin) and (@dateEnd is null or endTime <= @dateEnd)
View Complete Post