Finding Even or Odd number in Sql

Bageshkumarbagi
Posted by Bageshkumarbagi under Sql Server category on | Points: 40 | Views : 797
HI,

DECLARE @num int,@rem int
SET @num=11
SET @rem=@num%2
IF @rem > 0
BEGIN
PRINT 'ODD NUMBER'
END
ELSE
PRINT 'EVEN NUMBER'

------------------OutPut------------------------
ODD NUMBER

Comments or Responses

Login to post response