January 4, 2013 at 3:48 am
Hi Team,
Am using below query to find Leap year.
DECLARE @year INT
SET @year = 2012
IF (((@year % 4 = 0) AND (@year % 100 != 0)) OR (@year % 400 = 0))
PRINT 'Leap Year'
ELSE
print 'Not a Leap Year'
--
I want output like
2012 is a Leap year
2013 is not a Leap Year
--
Is below query is correct:
Print +@Year+ 'is a Leap Year'
Please help...
January 4, 2013 at 3:55 am
Not to far off
DECLARE @year INT
SET @year = 2013
IF (((@year % 4 = 0) AND (@year % 100 != 0)) OR (@year % 400 = 0))
PRINT CONVERT(VARCHAR,@Year) + ' is a leap year'
ELSE
PRINT CONVERT(VARCHAR,@Year) + ' is not a leap year'
January 4, 2013 at 3:59 am
:-)Thank U anthony:-)
🙂
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply