问题
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