SSRS - Passing one date parameter and using it as between

限于喜欢 提交于 2019-12-11 21:22:12

问题


Hi I am workikg with an SSRS report wherein i am passing a date from one report to anothere report with this sample format 7/6/2013, my problem is iam using this to the second report like this:

select recordnumber, employeename, empolyeeID, team, step, QA, convert(char(10), hireDate, 120) as hireDate, EmpStatus,Comments, convert(char(10), AssignDate, 120) as AssignDate
from tblQMRoster tr
inner join tblQATeamMaster tm
On tr.QAMemberID = tm.QAMemberID
inner join tblStepMaster sm
ON sm.stepDesc = tr.step
where sm.stepid = @StepID and tr.QAMemberID = @QAMemberID
and AssignDate like between  @Assigneddate and @AssignedDate

I had already tried AssignedDate like @AssignDate + '%' since i am only getting one day worth of data when the link in my report is clicked but the problem with this is i am getting all the reports not covered by my parameter.


回答1:


Can't you just use:

AND     AssignDate >= @Assigneddate 
AND     AssignDate < DATEADD(DAY, 1, @AssignedDate)

Two articles that are well worth a read on the subject:

What do BETWEEN and the devil have in common?

Bad habits to kick : mis-handling date / range queries



来源:https://stackoverflow.com/questions/19492671/ssrs-passing-one-date-parameter-and-using-it-as-between

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!