March 10, 2008 at 5:14 pm
🙂
March 10, 2008 at 5:21 pm
We need more info. What are you trying to do with Leap Years? Is your project named "Leap Years" or are you trying to calculate what the next N leap years will be or something else? What kinds of problems are you having. What have you tried so far?
March 10, 2008 at 5:26 pm
March 10, 2008 at 5:38 pm
j
March 10, 2008 at 5:47 pm
ksullivan (3/10/2008)
We need more info. What are you trying to do with Leap Years? Is your project named "Leap Years" or are you trying to calculate what the next N leap years will be or something else? What kinds of problems are you having. What have you tried so far?
so any ideas how to fix it? if can help me with code let me know please.Thanks
March 10, 2008 at 6:09 pm
This looks like homework and is not a sql server issue, so I am only posting pseudocode.
make a new date var as Jan 1 + the year part of startDate
begin loop
if mod 4 = 0
if mod 100 = 0
if mod 400 = 0
yes
loop
end if
no
loop
end if
yes
end if
add 1 year to the Jan 1 var
end loop
March 10, 2008 at 10:00 pm
The definition of leap years changed many times and leap years didn't always exist. In fact, depending on which country you're talking about, leap year definitions were different for a long time. And, you better get real familiar with the year 1752 to do this all and why 1752 made 01/01/1753 such an important date for SQL Server. There's also several different calendar shifts as folks finally figured out how long and actual year was and they didn't all happen in 1752.
Dare I even mention "Leap Seconds"? 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
March 12, 2008 at 5:38 am
After you pick a more reasonable starting data than 10000BC, give some serious thought to using something other than a loop to evaluate which years are leap years -- you would be better off to just calculate every 4th year with minor adjustments for the 100/400 year exceptions. (And remember that the date calculation functions in SQL Server account for leap years already.)
March 12, 2008 at 7:57 am
My biggest curiosity - why are we discussing VisualBasic homework in a SQL forum? The homework pretty much shoots any ability to leverage SQL Server, and I'm pretty sure your teacher would ding you for doing so.
That being said - good luck with it!
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
March 12, 2008 at 8:58 am
I hope you do not intend to store BC dates in SQL Server 2000.
In SQL Server 2000, the allowable range for the datetime type is from January 1, 1753 through December 31, 9999.
Sort of reminds me of a quizz show on TV where a contestant was asked in which years the war of independance occurred. The contestant was totally clueless and when told what it was, justified her ignorance by saying "I was not even born in those years".
Sacrificing history -- anything before 1753 is irrelevant as compared to the essential need to make provisions now to accommodate year 9999.
Maybe that got fixed in 2005...
March 14, 2008 at 9:04 am
Question must have been - which years for the 'American' war of independence?
There have been other WoI. My Citizens of the USA amigos or CUSAs for short plural (pronounced cussers). 😉
Hiding under a desk from SSIS Implemenation Work :crazy:
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply