freddoo
freddoo

Reputation: 6858

MSSQL 2012 Incorrect syntax near '>'

I'm trying to figure out why I'm getting this error

Incorrect syntax near '>'

I'm comparing 2 integer and even when I use the simplest form, I still get the error message

select 1 >= 0

or

select cast(1 as int) >=  cast(0 as int)

Is there a configuration that I need to set to be able to use greater or equal to ?

Upvotes: 0

Views: 127

Answers (1)

Devart
Devart

Reputation: 121932

SELECT IIF(1 >= 0, 'YES', 'NO') -- 2012+

SELECT CASE WHEN 1 >= 0 THEN 'YES' ELSE 'NO' END

IF 1 >= 0
    SELECT 'YES'
ELSE
    SELECT 'NO'

Upvotes: 2

Related Questions