Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Incorrect Syntax MS SQL

$
0
0

Hi ,

When I execute the following Query, I keep receiving and error.

Select s.gradyear, LEFT (sgm.calID ,4)AS CalYear,s.FName, s.LName,
Case
    When Left(sgm.calID,4) = 1998 and s.gradyear = 2002 then sgm.GradeLevel=9
    Else sgm.GradeLevel
End as GradeLevel
from StGrMark sgm left join Student s on s.sno = sgm.sno
where s.schoolNo=1 and sgm.RGID='S1' or s.schoolNo=1 and sgm.RGID='S2'

-- and sgm.Gradelevel='0'
Order By s.gradyear, s.LName, s.FName

The Error: 

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '='.

I've tried single quotes around numeric values but no luck


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>