Search code examples
variablesreporting-servicesparametersdeclare

SSRS 2008R2, Error "Must declare variable @PREndDate"


The following query works great in SQL, but when I use it in SSRS, I get an error of "Must declare variable @PREndDate". If I use actual date, then it is fine, but it does not like the use of the parameter for some reason; I have the parameter set as Date/Time. I had another friend try it, and they were able to run it with no issues, so it makes me wonder if there is a default setting somewhere causing this issue.

   select PRCo, PRGroup, PREndDate, EarnCode
     from PRTH

    where EarnCode IN ('13', '14') 
    and PREndDate = @PREndDate

Solution

  • If you are using this as your dataset in SSRS, you need to map the parameter to your report parameter in the Dataset properties. enter image description here