Simple query for the Months of a year

  • Steve you haven't heard to fix the budget the Gov is going to allow moths to be sponsored. next month will not be july it will be City Bank month.

    Sorry my sarcasm is working overtime today and I could not help myself.

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • Dan.Humphries (6/18/2010)


    Steve you haven't heard to fix the budget the Gov is going to allow moths to be sponsored. next month will not be july it will be City Bank month.

    Sorry my sarcasm is working overtime today and I could not help myself.

    Now there's a table dying to be built! I know oyu were being sarcastic, but it reminded me that

    July Is:

    UV Safety Month

    National Park Month

    National Baked Beans Month

    National Ice Cream Month

    National Tennis Month

    Read An Almanac Month

    Anti-Boredom Month

    Hitchhiking Month

    Bereaved Parents Month

    Bioterrorism/Disaster Education and Awareness Month

    Blueberries Month

    Cell Phone Courtesy Month

    Family Reunion Month

    Hemochromatosis Screening Awareness Month

    Herbal/Prescription Awareness Month

    International Blondie and Deborah Harry Month

    International Group B Strep Awareness Month

    Lasagna Awareness Month

    National Child-Centered Divorce Month

    National Culinary Arts Month

    National Doghouse Repairs Month

    National Grilling Month

    National Horseradish Month

    National Hot Dog Month

    National Make a Difference to Children Month

    National Pickle Month

    National Picnic Month

    National Share A Sunset With Your Lover Month

    National Wheelchair Beautification Month

    Sandwich Generation Month

    Smart Irrigation Month

    Social Wellness Month

    Tour de France Month

    Women's Motorcycle Month

    Fireworks Safety Month

    And that's just the start! There's more out there.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    Itโ€™s unpleasantly like being drunk.
    Whatโ€™s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • That list is cracking me up. Anti-Boredom Month roflmao!! ๐Ÿ˜€

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • I think my favorite is International Blondie and Deborah Harry Month

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    Itโ€™s unpleasantly like being drunk.
    Whatโ€™s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • July is Lasagna Awareness Month ?? OMG!!! I've been celebrating it all wrong.

    ๐Ÿ˜€

    Converting oxygen into carbon dioxide, since 1955.
  • If we are truly going to implement those months, some of which I really like, I guess we'd want a table. After all, who knows when we will have Celebrate-Texting-Month and Drink-A-Diet-Soda month as well. Wouldn't want to update too many reports for those :w00t:

  • Steve Jones - Editor (6/18/2010)


    For one to 12? Rounds trip to the server? Wouldn't it be easier to hard code these in? AFAIK, months don't change often.

    Wouldn't the table option be actually a good option?

    Especially since it could easily accomodate Fiscal periods, callendar periods, week of year, month of year, quarters.

    Not that I don't mind seeing some great code once in awhile, but sometime simpler is better.

    Nothing simpler than you have a floating holiday that changes every year, and just have to flip a 1 to a 0, and your number of days in a week could be fixed everywhere you use it in a calculation.

    Greg E

  • just to throw my two since in I think that if you are doing a full blown table with dates then this is a better option this is particularly useful if you plan to use it as a tally table. See Jeff moden's article Here[/url]

    However if you are just pulling 12 records to use as a parameter in a report and nothing else then this is a fair bit of overkill unless you have to right hundreds of reports using this parameter. in that case it might be worth writing a SP to pull the params in.

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • Dan.Humphries (6/18/2010)


    just to throw my two since in I think that if you are doing a full blown table with dates then this is a better option this is particularly useful if you plan to use it as a tally table. See Jeff moden's article Here[/url]

    However if you are just pulling 12 records to use as a parameter in a report and nothing else then this is a fair bit of overkill unless you have to right hundreds of reports using this parameter. in that case it might be worth writing a SP to pull the params in.

    Heh... owch! I got a little whiplash here. ๐Ÿ˜‰

    I have to ask, Dan... knowing that there are probably a half dozen easy to use set based solutions for this, why did you first solve the problem on this thread with a While Loop?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Bad habits die hard and it was before I read your article from another post.

    that and it was 12 records so I must admit I gave it little thought.

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • Actually before I read your article I must admit I gave very little thought to set based programming at all.

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • Dan.Humphries (6/18/2010)


    Actually before I read your article I must admit I gave very little thought to set based programming at all.

    Now, this here is a man that isn't afraid to speak the truth. And, apparently, willing to face up to his mistakes! ๐Ÿ˜‰

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • WayneS (6/18/2010)


    Dan.Humphries (6/18/2010)


    Actually before I read your article I must admit I gave very little thought to set based programming at all.

    Now, this here is a man that isn't afraid to speak the truth. And, apparently, willing to face up to his mistakes! ๐Ÿ˜‰

    Agreed. Thanks for the feedback, Dan.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Greg Edwards-268690 (6/18/2010)


    Steve Jones - Editor (6/18/2010)


    For one to 12? Rounds trip to the server? Wouldn't it be easier to hard code these in? AFAIK, months don't change often.

    Wouldn't the table option be actually a good option?

    Especially since it could easily accomodate Fiscal periods, callendar periods, week of year, month of year, quarters.

    Not that I don't mind seeing some great code once in awhile, but sometime simpler is better.

    Nothing simpler than you have a floating holiday that changes every year, and just have to flip a 1 to a 0, and your number of days in a week could be fixed everywhere you use it in a calculation.

    Greg E

    Completely agree if that's a possibility. If it's only a 1-12 calculation, why hit the database ever?

  • Steve Jones - Editor (6/18/2010)


    Greg Edwards-268690 (6/18/2010)


    Steve Jones - Editor (6/18/2010)


    For one to 12? Rounds trip to the server? Wouldn't it be easier to hard code these in? AFAIK, months don't change often.

    Wouldn't the table option be actually a good option?

    Especially since it could easily accomodate Fiscal periods, callendar periods, week of year, month of year, quarters.

    Not that I don't mind seeing some great code once in awhile, but sometime simpler is better.

    Nothing simpler than you have a floating holiday that changes every year, and just have to flip a 1 to a 0, and your number of days in a week could be fixed everywhere you use it in a calculation.

    Greg E

    Completely agree if that's a possibility. If it's only a 1-12 calculation, why hit the database ever?

    We have 100's of reports (SQL RS), and this table also feeds our time dimension in the cube.

    And probably 10 to 20 times that many SSAS views, so it would be painful if we didn't centralize time.

    I seem to recall the OP mentioned year also at one point, which to me, would make it more than just a simple 1 to 12.

    Things tend to grow, and it's better to think about that before you have to do a ton on burger flipping.

    I agree with avoiding the round trips, but if you start doing this in numerous reports, and requirements change, round trips to a table or sp might not look so bad.

    So I guess it depends....

    Greg E

Viewing 15 posts - 16 through 29 (of 29 total)

You must be logged in to reply to this topic. Login to reply