February 2, 2012 at 3:35 pm
I am building a calendar table, and would like to be able to add astronomy calculations to it (or to its own table that I'd join it with). For example, if there's a full moon on 2012/02/07 at 22H, or that the Vernial Equinox is on 2012/03/20 at 05H, etc. Or that a Solar/Lunar eclipse occurs on a certain day, etc.
I've found almanacs online but not found anything with a SQL function like ones determining Easter. I've also found other calendar info here but none of it deals with any celestial or astronomic calculations.
I've found a few routines (in C) for calculating a few of those things, but their accuracy may be questionable, or they may not be easily ported to T-SQL. Has anyone done a SQL routine for doing just this type of calculation?
February 2, 2012 at 5:43 pm
Lowell has made this one, it is pretty comprehensive.
http://www.stormrage.com/SQLStuff/TallyCalendar_Complete_With_DST.txt
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 2, 2012 at 6:04 pm
Jason, much thanks for the link!
February 2, 2012 at 6:07 pm
You're welcome.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 3, 2012 at 8:29 am
Thank you for the link, Jason.
This is partly what I was looking for. I had wanted to provide even more in-depth info if possible.
February 3, 2012 at 11:56 am
Steve_o (2/3/2012)
Thank you for the link, Jason.This is partly what I was looking for. I had wanted to provide even more in-depth info if possible.
Jason thanks for the salute and remembering where that script is sitting!
That Calendar table is a good base for anyone to start out with, I think; I've been working on adding Sunrise and Sunset,
but I haven't had a free weekend to finish that up; also it depends on your latitude and longitude,a s well as your definition of sunrise.
the formula i have has like 4 or 5 definitions...azimuth and a bunch of others i don't remember offhand.
@Steve_o if you can find a formula for calculating vernal equinox and such, , some of us might throw some volunteer time into converting it to TSQL;
You'll have to do some of the legwork for getting the underlying definitions of what you might want to add to any calendar table.
Lowell
February 6, 2012 at 8:45 am
@lowell - you're welcome
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply