In an SSRS report, the user searches based on start date and end date.
The challenge is, as I discovered recently, he sometimes, not always, provides the time component while searching.
Currently, the filter is done like this:
if @pEndDate is null
SET @pEndDate = getdate()
SET @PEndDate = DateAdd(dd,1,@PEndDate)
SELECT ........
FROM .....
WHERE ( Createdon >= @PStartDate AND Createdon < @PEndDate)
This is fine when he searches without time (example - @PStartDate = 2/23/2015 and @PEndDate = 2/24/2015)
How should I structure the query to deal with the time portion when he provides it? (example - @PStartDate = 2/23/2015 15:00 and @PEndDate = 2/24/2015 15:00)
If this is answered elsewhere, please point me to it. Thank you.
Aucun commentaire:
Enregistrer un commentaire