have a query relating to MS SQL Server.
I'm going to have to be vague with details and change or remove certain parts as i can't say whether the info is confidential or not, but I've written a query that searches for students with their training units spanning across semesters using report builder 2.0:
DS_spanning: (Main dataset)
SET DATEFORMAT dmy
SELECT
FIRST_NAME AS FirstName
,LAST_NAME AS LastName
,START_DATE AS StartDate
,END_DATE AS EndDate
,UNIT_TYPE AS UnitType
,TP_FULLNAME AS TrainingPost
,SEMESTER_YEAR AS SemesterYear
FROM AA_GPR_TU
WHERE TU_START_DATE < @checkdate //Checkdate returns the end date of the
AND TU_END_DATE > @checkdate // selected semester
ORDER BY TU_START_DATE
PM_checkdate: (Dataset that @checkdate is linked to)
SET DATEFORMAT dmy
SELECT
new_semesterenddate
,new_semesterstartdate
,new_semesternumber
,new_semesteryear
,new_name
FROM
FilteredNew_rtpsemester
WHERE new_semesteryear >= 2004
ORDER BY new_semesterenddate DESC
Now, this works fine and does the job i want it to, however i can only select one semester at a time. When i try to tick the 'Allow Multiple Values' box under the Report Parameter Properties for @checkdate, running the report with more than one semester selected gives me this error:
Incorrect syntax near ','.
Query execution failed for dataset 'DS_spanning'.
An error has occurred during report processing.
An error occurred during local report processing.**
(The problem with a ',' is because when i select multiple values for the report, it supplies them to @checkdate as data1, data2, data3... etc.)
Is there something wrong with the way my parameter has been written, or do i need to change my query to accomodate multiple values?
Easiest way i could think of doing this would be using an IN statement in the section
WHERE TU_START_DATE < @checkdate AND TU_END_DATE > @checkdate
but i'm not sure how to use an IN statement in conjunction with and operands.
Any ideas folks?