No, it just shows the title of my SP (Reporting_StandardsBasedReportCard_2013;1) and the fields (listed only once) from the firts table. This is my SP:
USE [D_150000]
GO
/****** Object: StoredProcedure [dbo].[Reporting_StandardsBasedReportCard_2013] Script Date: 11/13/2013 07:54:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Reporting_StandardsBasedReportCard_2013]
(
@StudentId BIGINT,
@CalendarId BIGINT,
@Term TINYINT,
@Language CHAR(2)
)
AS
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SELECT
MIN(EnrollmentStatus.[Status]) AS [Status],
CASE
WHEN LEN(ISNULL(AlternateCourseCode,''))=0 THEN Course.Code
ELSE AlternateCourseCode
END AS CourseNumber,
Section.LocalId AS SectionNumber,
rpt.TruncateExtraData(Course.Name, '0') AS CourseDescription,
RptGradingTerm.ReportCode,
CASE
WHEN GradebookTermGrade.OverrideCode IS NOT NULL
THEN GradebookTermGrade.OverrideCode
ELSE GradebookTermGrade.Letter
END AS Letter,
LearningStandard.StatementCode AS LearningStandardNumber,
Person.LastName AS PrimaryTeacherLastName,
Person.FirstName AS PrimaryTeacherFirstName,
EnrollmentStatus.CalendarId,
EnrollmentStatus.StudentId,
LearningStandardLevel.Number AS [Level],
RptGradingTerm.GradingTermId,
lss.[Numeric] AS [Numeric],
lss.Letter AS LearningStandardScoreLetter,
LearningStandardStatement.[Language] AS [Language],
Predecessor.StatementCode AS PredecessorLearningStandardNumber,
rpt.TruncateExtraData(LearningStandardStatement.[Statement], '-') AS [Statement],
rpt.GetFullname(NULL,NULL,Person.LastName,Person.FirstName,Person.MiddleName,Person.Prefix) AS TeacherFullname,
CASE
WHEN LearningStandard.StatementCode like 'BE%'
THEN
CASE
WHEN (Course.Name like 'LANGUAGE%' or Course.Name like 'WRITING%' or Course.Name like 'READING%'or Course.Name like 'SPEAKING%')
THEN 1
WHEN Course.Name like 'MATH%' THEN 2
WHEN Course.Name like 'SOCIAL%' THEN 4
WHEN Course.Name like 'SCIENCE%' THEN 3
WHEN Course.Name like 'HEALTH%' THEN 5
WHEN Course.Name like 'PHYSICAL%' THEN 6
WHEN Course.Name like 'MUSIC%' THEN 7
WHEN Course.Name like 'ART%' OR Course.Name like 'TECH%' THEN 8
ELSE LearningStandard.Sequence
END
ELSE LearningStandard.Sequence
END AS Sequence,
STUFF(
(SELECT '; ' + gs.BreakpointDescription FROM RptTermComment tc
INNER JOIN RptGradingScale gs ON gs.GradingScaleId=tc.GradingScaleId AND gs.Letter=tc.Code
JOIN RptGradingTerm gt1 ON
gt1.CalendarId=@CalendarId --AND
gt1.ReportCode=@ReportCode WHERE
StudentId=@StudentId AND tc.GradingTermId=gt1.GradingTermId
AND tc.SectionEnrollmentId=lss.SectionEnrollmentId
FOR XML PATH('')),1,1,'' ) AS CannedComments,
(select a1.Comments
from AssignmentScore a1
inner join Assignment a2
on a1.AssignmentId = a2.AssignmentId
inner join Gradebook g3
on a2.GradebookId = g3.GradebookId
where a2.ShowInView = '4' and
StudentId=@StudentId and a2.gradebookid = GradebookTerm.GradebookId
)
as notes
FROM
rpt.ComputeEnrollmentStatus (@CalendarId, NULL, @StudentId) AS EnrollmentStatus
INNER JOIN Section ON Section.SectionId = EnrollmentStatus.SectionId
INNER JOIN Course ON Course.CourseId = Section.CourseId
INNER JOIN Teacher ON Teacher.TeacherId = Section.PrimaryTeacherId
INNER JOIN Person ON Person.PersonId = Teacher.PersonId
INNER JOIN RptGradingTerm ON RptGradingTerm.GradingTermId = EnrollmentStatus.GradingTermId
INNER JOIN rpt.GenerateTermReportCodes(@Term, 'Q') ReportCodes ON RptGradingTerm.ReportCode = ReportCodes.ReportCode
INNER JOIN GradebookTerm ON GradebookTerm.GradebookId = Section.GradebookId
AND GradebookTerm.GradingTermId=RptGradingTerm.GradingTermId
LEFT OUTER JOIN GradebookTermGrade ON GradebookTermGrade.GradebookTermId=GradebookTerm.GradebookTermId
AND GradebookTermGrade.StudentId = EnrollmentStatus.StudentId
INNER JOIN LearningStandardLink ON LearningStandardLink.CourseOfferingId = Section.CourseOfferingId
AND LearningStandardLink.GradingTermId=EnrollmentStatus.GradingTermId
INNER JOIN LearningStandard ON LearningStandard.LearningStandardId = LearningStandardLink.LearningStandardId
INNER JOIN LearningStandardStatement ON LearningStandard.LearningStandardId = LearningStandardStatement.LearningStandardId
INNER JOIN LearningStandardLevel ON LearningStandardLevel.LearningStandardLevelId = LearningStandard.LearningStandardLevelId
LEFT OUTER JOIN LearningStandard Predecessor ON Predecessor.LearningStandardId = LearningStandard.LearningStandardPredecessorId
LEFT OUTER JOIN RptLearningStandardScore lss ON lss.LearningStandardId = LearningStandardLink.LearningStandardId
AND lss.SectionEnrollmentId = EnrollmentStatus.SectionEnrollmentId
AND lss.GradingTermId = LearningStandardLink.GradingTermId
WHERE
LearningStandard.IsDeleted = 0
AND LearningStandardStatement.[Language] = @Language
AND Course.Code <> '996'
AND LearningStandardLevel.Number = 3
AND Course.Name not like '%Homeroom%'
AND LearningStandard.StatementCode not like 'BE%'
GROUP BY
AlternateCourseCode,
Course.Code,
Section.LocalId,
Course.Name,
RptGradingTerm.ReportCode,
GradebookTermGrade.OverrideCode,
GradebookTermGrade.Letter,
LearningStandard.StatementCode,
Person.LastName,
Person.FirstName,
EnrollmentStatus.CalendarId,
EnrollmentStatus.StudentId,
LearningStandardLevel.Number,
RptGradingTerm.GradingTermId,
lss.[Numeric],
lss.Letter,
LearningStandardStatement.[Language],
Predecessor.StatementCode,
LearningStandardStatement.[Statement],
Person.LastName,
Person.FirstName,
Person.MiddleName,
Person.Prefix,
LearningStandard.sequence,
lss.SectionEnrollmentId,
lss.[Level],
GradebookTerm.GradebookId
ORDER BY
LearningStandard.sequence
SELECT
MIN(EnrollmentStatus.[Status]) AS [Status],
CASE
WHEN LEN(ISNULL(AlternateCourseCode,''))=0 THEN Course.Code
ELSE AlternateCourseCode
END AS CourseNumber,
Section.LocalId AS SectionNumber,
rpt.TruncateExtraData(Course.Name, '0') AS CourseDescription,
RptGradingTerm.ReportCode,
CASE
WHEN GradebookTermGrade.OverrideCode IS NOT NULL
THEN GradebookTermGrade.OverrideCode
ELSE GradebookTermGrade.Letter
END AS Letter,
LearningStandard.StatementCode AS LearningStandardNumber,
Person.LastName AS PrimaryTeacherLastName,
Person.FirstName AS PrimaryTeacherFirstName,
EnrollmentStatus.CalendarId,
EnrollmentStatus.StudentId,
LearningStandardLevel.Number AS [Level],
RptGradingTerm.GradingTermId,
lss.[Numeric] AS [Numeric],
lss.Letter AS LearningStandardScoreLetter,
LearningStandardStatement.[Language] AS [Language],
Predecessor.StatementCode AS PredecessorLearningStandardNumber,
rpt.TruncateExtraData(LearningStandardStatement.[Statement], '-') AS [Statement],
rpt.GetFullname(NULL,NULL,Person.LastName,Person.FirstName,Person.MiddleName,Person.Prefix) AS TeacherFullname,
CASE
WHEN LearningStandard.StatementCode like 'BE%'
THEN
CASE
WHEN (Course.Name like 'LANGUAGE%' or Course.Name like 'WRITING%' or Course.Name like 'READING%'or Course.Name like 'SPEAKING%')
THEN 1
WHEN Course.Name like 'MATH%' THEN 2
WHEN Course.Name like 'SOCIAL%' THEN 4
WHEN Course.Name like 'SCIENCE%' THEN 3
WHEN Course.Name like 'HEALTH%' THEN 5
WHEN Course.Name like 'PHYSICAL%' THEN 6
WHEN Course.Name like 'MUSIC%' THEN 7
WHEN Course.Name like 'ART%' OR Course.Name like 'TECH%' THEN 8
ELSE LearningStandard.Sequence
END
ELSE LearningStandard.Sequence
END AS Sequence,
STUFF(
(SELECT '; ' + gs.BreakpointDescription FROM RptTermComment tc
INNER JOIN RptGradingScale gs ON gs.GradingScaleId=tc.GradingScaleId AND gs.Letter=tc.Code
JOIN RptGradingTerm gt1 ON
gt1.CalendarId=@CalendarId --AND
gt1.ReportCode=@ReportCode WHERE
StudentId=@StudentId AND tc.GradingTermId=gt1.GradingTermId
AND tc.SectionEnrollmentId=lss.SectionEnrollmentId
FOR XML PATH('')),1,1,'' ) AS CannedComments,
(select a1.Comments
from AssignmentScore a1
inner join Assignment a2
on a1.AssignmentId = a2.AssignmentId
inner join Gradebook g3
on a2.GradebookId = g3.GradebookId
where a2.ShowInView = '4' and
StudentId=@StudentId and a2.gradebookid = GradebookTerm.GradebookId
)
as notes
FROM
rpt.ComputeEnrollmentStatus (@CalendarId, NULL, @StudentId) AS EnrollmentStatus
INNER JOIN Section ON Section.SectionId = EnrollmentStatus.SectionId
INNER JOIN Course ON Course.CourseId = Section.CourseId
INNER JOIN Teacher ON Teacher.TeacherId = Section.PrimaryTeacherId
INNER JOIN Person ON Person.PersonId = Teacher.PersonId
INNER JOIN RptGradingTerm ON RptGradingTerm.GradingTermId = EnrollmentStatus.GradingTermId
INNER JOIN rpt.GenerateTermReportCodes(@Term, 'Q') ReportCodes ON RptGradingTerm.ReportCode = ReportCodes.ReportCode
INNER JOIN GradebookTerm ON GradebookTerm.GradebookId = Section.GradebookId
AND GradebookTerm.GradingTermId=RptGradingTerm.GradingTermId
LEFT OUTER JOIN GradebookTermGrade ON GradebookTermGrade.GradebookTermId=GradebookTerm.GradebookTermId
AND GradebookTermGrade.StudentId = EnrollmentStatus.StudentId
INNER JOIN LearningStandardLink ON LearningStandardLink.CourseOfferingId = Section.CourseOfferingId
AND LearningStandardLink.GradingTermId=EnrollmentStatus.GradingTermId
INNER JOIN LearningStandard ON LearningStandard.LearningStandardId = LearningStandardLink.LearningStandardId
INNER JOIN LearningStandardStatement ON LearningStandard.LearningStandardId = LearningStandardStatement.LearningStandardId
INNER JOIN LearningStandardLevel ON LearningStandardLevel.LearningStandardLevelId = LearningStandard.LearningStandardLevelId
LEFT OUTER JOIN LearningStandard Predecessor ON Predecessor.LearningStandardId = LearningStandard.LearningStandardPredecessorId
LEFT OUTER JOIN RptLearningStandardScore lss ON lss.LearningStandardId = LearningStandardLink.LearningStandardId
AND lss.SectionEnrollmentId = EnrollmentStatus.SectionEnrollmentId
AND lss.GradingTermId = LearningStandardLink.GradingTermId
WHERE
LearningStandard.IsDeleted = 0
AND LearningStandardStatement.[Language] = @Language
AND Course.Code <> '996'
AND LearningStandardLevel.Number = 4
AND Course.Name not like '%Homeroom%'
AND LearningStandard.StatementCode like 'BE%'
GROUP BY
AlternateCourseCode,
Course.Code,
Section.LocalId,
Course.Name,
RptGradingTerm.ReportCode,
GradebookTermGrade.OverrideCode,
GradebookTermGrade.Letter,
LearningStandard.StatementCode,
Person.LastName,
Person.FirstName,
EnrollmentStatus.CalendarId,
EnrollmentStatus.StudentId,
LearningStandardLevel.Number,
RptGradingTerm.GradingTermId,
lss.[Numeric],
lss.Letter,
LearningStandardStatement.[Language],
Predecessor.StatementCode,
LearningStandardStatement.[Statement],
Person.LastName,
Person.FirstName,
Person.MiddleName,
Person.Prefix,
LearningStandard.sequence,
lss.SectionEnrollmentId,
lss.[Level],
GradebookTerm.GradebookId
ORDER BY
LearningStandard.sequence