I'm writing a sql query for an SSRS report and wanted to paramterize the @startdate
and @endate
fields for the user to specify. Yet when I put my query into SSRS, the user input is ignored. I was wondering if it had to do with the fact that I wasn't assigning to a parameter but comparing to it?
These are my declaration statements:
DECLARE @startdate NVARCHAR(10)
DECLARE @enddate NVARCHAR(10)
And this is my where clause:
WHERE assignees.id = customers.id
AND
((dateadd(second,open_date,'19700101') >= @startdate
AND dateadd(second,open_date,'19700101') <= @enddate)
OR
(dateadd(second,close_date,'19700101') >= @startdate
AND dateadd(second,close_date,'19700101') <= @enddate))
AND group_name = 'SPRQ'