Gagan Sharma

Gagan Sharma

  • NA
  • 2.7k
  • 217.6k

why i am getting error?

May 16 2017 5:24 AM
In Sql Server when i run query : 
Select Case when 5>2 then 1
          else 2 end
its working perfectly, But when i run the below query its showing error ? 
 
Query : Select 5 > 2
 
Output:
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near '>'.
 
Why error ? instead of displaying True or false or 1 or 2? on comparison . 
 

Answers (4)