Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I am executing following statements in sql server 2012 but am getting error saying that "Incorrect syntax near >"

SQL
DECLARE @NUMBER INT=10
SELECT IIF(@NUMBER >10,'TRUE','FALSE') AS DD



could anyone help me to resolve this problem.

Thanks and Regards,
Prakash.ch
Posted
Comments
Raja Sekhar S 17-Jul-13 3:44am    
It's Running Fine in Sql Server 2012.... Check whether you are running in Sql server 2012 or lower version...

try this...:)

SQL
DECLARE @NUMBER INT=10
SELECT CASE
WHEN @NUMBER > 10 THEN 'TRUE'
ELSE 'FALSE' END AS DD;
 
Share this answer
 
v2
Comments
prakash.chakrala 17-Jul-13 2:36am    
hi thank you for your reply I want to use new iif function in sql server 2012 but not case statement.
Thank you
Nirav Prabtani 17-Jul-13 2:40am    
can i know why do you have need of only "iff" function??
Try with bellow code as alternative

SELECT CASE WHEN @NUMBER > 10 THEN 'TRUE' ELSE 'FALSE' END
 
Share this answer
 
Comments
ArunRajendra 17-Jul-13 2:41am    
Why are you posting duplicate answers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900