shiji josh

shiji josh

  • NA
  • 2
  • 619

solve incorect syntax near )

May 23 2019 4:51 AM
exec('INSERT INTO #ExamMarkEntryTotal SELECT SYD.StudentID,EM.ExamID,-1,2,ECSD.SubjectID,0 AS SubjectDivisionId,ESGM.SubjectGroupID,ESGM.EntryTypeId,
ECSD.PriorityNo,ROUND(CASE WHEN ME.Mark<0 THEN 0 ELSE ME.Mark END,1),ECSMD.MaximumMark,ECSMD.MinimumMark,ME.Remark,ECSD.ClasswiseSubjectId,ECGD.ExamGroupID,ME.Mark,ECSMD.Weightage
FROM StudentAcademicYearWisedetails SYD INNER JOIN ClassSectionDetails CSD ON CSD.ClassID=SYD.ClassId AND
CSD.SectionID=SYD.SectionID AND SYD.AcademicYearID=CSD.AcademicYearID INNER JOIN ExamClasswiseSubjectDetails ECSD ON CSD.ClassDetailID=ECSD.ClassDetailID
INNER JOIN ExamClasswiseSubjectMarkDetails ECSMD ON ECSD.ClasswiseSubjectID=ECSMD.ClasswiseSubjectId
LEFT JOIN ExamOptionalSubjectDetails OSD ON OSD.ClassDetailID=ECSD.ClassDetailID AND OSD.SubjectID=ECSD.SubjectId
LEFT JOIN ExamStudentOptionalSubjectDetails SOSD ON SOSD.StudentID=SYD.StudentID AND SOSD.SubjectID=ECSD.SubjectId
LEFT JOIN ExamMarkEntry ME ON ME.StudentId=SYD.StudentID AND ME.ClasswiseSubjectId=ECSD.ClasswiseSubjectID
LEFT JOIN ExamMarkAbbreviationMaster MA ON MA.ExamMarkAbbreviationID=ME.Mark
INNER JOIN ExamMaster EM ON EM.ExamID=ECSD.ExamID INNER JOIN
ExamClassGroupDetails ECGD ON ECGD.ClassDetailID=CSD.ClassDetailID INNER JOIN
ExamGroupExamDetails EGED ON ECSD.ExamID=EGED.ExamID AND EGED.ExamGroupID=ECGD.ExamGroupID INNER JOIN
ExamSubjectMaster ESM ON ESM.SubjectID=ECSD.SubjectID INNER JOIN ExamSubjectGroupMaster ESGM ON
ESGM.SubjectGroupID=ESM.SubjectGroupID
WHERE ESM.SSubjectID NOT IN ('+@AttSubjectID+') AND ESM.SubjectTypeID=1 AND (OSD.SubjectID is null OR SOSD.SubjectID is not null) AND SYD.AcademicYearID='+@AcademicYearID+' AND ESGM.EntryTypeId=1 AND CSD.ClassID='+@ClassID+' AND CSD.SectionID='+@SectionID+' AND
EM.ExamID IN ('+@Exams+') '+@strQry+'')

Answers (3)