Calendar table, Equinox/Solstice & Astronomy calculations

  • 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?

  • 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

  • Jason, much thanks for the link!

  • 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

  • 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.

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • @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