I have a SQL query for an SSRS report to return results where record was created between 2 dates, I am using parameters as for the date values
select * from results
where [startdate] >=@datestart or [startdate] <=@dateend
when I run the SSRS report and select the same date for @startdate and @enddate I get 2 records returned which I know is incorrect. when I run the SQL query and use a date eg '01 feb 2019' rather than the parameter I get different results. Do I need to exclude time from my parameters or set the time for @startdate to be 00:00:00 and set @dateend to be 23:59:59 to get the same results if I was using an actual date?
or
in your script should really be anand
by the way... – iamdaveAND
instead ofOR
here. When the underlying column includes a time, it is best to specify an inclusive start date and exclusive end date, such asWHERE [startdate] >=@datestart AND [startdate] < DATEADD(day, 1, @dateend)
. – Dan Guzman