I need to be able to tell if a number is even or odd
I tried this but it is giving errors
I am trying to create a UDF
DECLARE @rate int
if @proj_no = ((@proj_no % 2)=0) set @rate = 2
else set @rate = 1
The errors are
Msg 102, Level 15, State 1, Procedure nRate, Line 6
Incorrect syntax near '='.
Msg 156, Level 15, State 1, Procedure nRate, Line 7
Incorrect syntax near the keyword 'else'.