In a new ssrs 2012 report, I am having problem the report displaying the data from a sql server 2016 report. Basically I wrote a query in t-sql 2012, and I am obtaining the results I want to see when I run the query in Sql server management studio.
However when I run the report, I am not getting the data results I am expecting see. I know the problem is the data being displayed in the report since I placed the selected data from a date field called ‘enddate’ in a textbox field. The field in the database is in type smalldatetime and nulls are allowed.
When I run the ssrs 2012, the data being is ‘null’. In the sql listed below the field call
‘ImpactAidEmployment.enddate’
Can you tell me what I can do to s'olve the problem?
Here is the sql:
--debug
--DECLARE @endYear SMALLINT = 2016
--DECLARE @calendarID INT = (SELECT calendarid FROM OPS.dbo.Calendar WHERE name LIKE '%central h%' AND endYear = @endYear AND summerSchool = 0) --6153
--end debug
SELECT DISTINCT Common.identityID, Common.personID, Common.structureID, Common.enrollmentID, Common.calendarID, Common.startYear, Common.endYear,
Common.schoolID, Common.schoolType, Common.schoolName, Common.studentNumber, Common.grade, Common.gradeSeq,
Common.fullName, Common.firstName, Common.middleName, Common.lastName, Common.suffix, Common.gender, Common.birthdate, Common.hispanicEthnicity,
Common.raceid1, Common.raceid2, Common.raceid3, Common.raceid4, Common.raceid5, Common.homeLanguage, COPPA.COPPAyesno
,Case when (GuardianMilitary2.guardianFirstName is null) or (GuardianMilitary2.guardianLastName is null)
then ltrim(substring(coalesce(GuardianMilitary.guardianFirstName,'') + ' ' + coalesce(GuardianMilitary.guardianLastName,''),1,55))
else ltrim(substring(coalesce(GuardianMilitary.guardianFirstName,'') + ' ' + coalesce(GuardianMilitary.guardianLastName,'') + ', ' + coalesce(GuardianMilitary2.guardianFirstName,'') + ' ' + coalesce(GuardianMilitary2.guardianLastName,''),1,55))
end as GuardiansNames
,ImpactAidEmployment.startdate,ImpactAidEmployment.enddate
FROM CampusOps.dbo.vSaFIGetCommonStudentInfo AS Common
LEFT JOIN (SELECT personID, value AS COPPAyesno --Census > People > Demographics custom tab
FROM OPS.dbo.CustomStudent WITH (NOLOCK)
WHERE attributeID = 3781) AS COPPA
ON COPPA.personID = Common.personID
JOIN ops.dbo.RelatedPair RelatedPair
on RelatedPair.personid1 = Common.personID
LEFT JOIN ops.dbo.ImpactAidEmployment ImpactAidEmployment
on ImpactAidEmployment.personID = RelatedPair.personid2
and ImpactAidEmployment.startdate is not null
LEFT JOIN OPS.dbo.v_GuardianMilitaryConnections GuardianMilitary -- contains guardian information that is needed
on GuardianMilitary.personID = Common.personID and GuardianMilitary.guardianStatus like '%Active Duty%'
LEFT JOIN OPS.dbo.v_GuardianMilitaryConnections GuardianMilitary2 -- contains guardian information that is needed
on GuardianMilitary2.personID = GuardianMilitary.personID
and (GuardianMilitary2.guardianPersonID <> GuardianMilitary.guardianPersonID)
and GuardianMilitary2.guardianStatus like '%Active Duty%'
WHERE Common.calendarID = @calendarID
AND Common.personID = @personID
AND Common.serviceType in (@serviceType)
ica.