Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Finding “Active” Rows for the Previous Month (SQL Spackle) Expand / Collapse
Author
Message
Posted Wednesday, January 29, 2014 10:28 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 1:13 PM
Points: 35,969, Visits: 30,261
Comments posted to this topic are about the item Finding “Active” Rows for the Previous Month (SQL Spackle)

--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." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1536164
Posted Thursday, January 30, 2014 4:19 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 3:56 PM
Points: 1,654, Visits: 5,208
Nice job Jeff!

MM


  • MMGrid Addin
  • MMNose Addin


  • Forum Etiquette: How to post Reporting Services problems
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • How to Post Performance Problems - by Gail Shaw

  • Post #1536243
    Posted Thursday, January 30, 2014 5:27 AM


    SSCertifiable

    SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

    Group: General Forum Members
    Last Login: Thursday, April 17, 2014 9:49 AM
    Points: 6,798, Visits: 6,272
    mister.magoo (1/30/2014)
    Nice job Jeff!

    +1



    Far away is close at hand in the images of elsewhere.

    Anon.

    Post #1536267
    Posted Thursday, January 30, 2014 6:52 AM
    Say Hey Kid

    Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

    Group: General Forum Members
    Last Login: Thursday, April 17, 2014 1:04 AM
    Points: 689, Visits: 753
    Excellent article. A problem that i have never come across but may do. The train of thought on the problem was insightful.
    Post #1536298
    Posted Thursday, January 30, 2014 6:58 AM


    SSC-Dedicated

    SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

    Group: General Forum Members
    Last Login: Today @ 1:13 PM
    Points: 35,969, Visits: 30,261
    Thanks guys. I appreciate it.

    --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." -- 04 August 2013
    (play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

    Helpful Links:
    How to post code problems
    How to post performance problems
    Post #1536306
    Posted Thursday, January 30, 2014 7:01 AM


    SSC-Dedicated

    SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

    Group: General Forum Members
    Last Login: Today @ 1:13 PM
    Points: 35,969, Visits: 30,261
    danielfountain (1/30/2014)
    Excellent article. A problem that i have never come across but may do. The train of thought on the problem was insightful.


    That, good sir, is why I didn't simply submit this as a script. Understanding why this works may lead someone to doing something even better.

    Thank you for the feedback.


    --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." -- 04 August 2013
    (play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

    Helpful Links:
    How to post code problems
    How to post performance problems
    Post #1536314
    Posted Thursday, January 30, 2014 7:02 AM
    Forum Newbie

    Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

    Group: General Forum Members
    Last Login: Thursday, January 30, 2014 8:17 AM
    Points: 2, Visits: 2
    Everything is right, but there are and other ways how to make your code bullet proof.
    Post #1536316
    Posted Thursday, January 30, 2014 7:09 AM


    SSC-Dedicated

    SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

    Group: General Forum Members
    Last Login: Today @ 1:13 PM
    Points: 35,969, Visits: 30,261
    vitex2003 (1/30/2014)
    Everything is right, but there are and other ways how to make your code bullet proof.


    Thanks for the insight. Would you post some code for said bullet proofing? Thanks.


    --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." -- 04 August 2013
    (play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

    Helpful Links:
    How to post code problems
    How to post performance problems
    Post #1536323
    Posted Thursday, January 30, 2014 7:25 AM


    SSCommitted

    SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

    Group: General Forum Members
    Last Login: 2 days ago @ 7:35 AM
    Points: 1,625, Visits: 2,034
    When I went to review this spackle, I found the current rating was "Good". Can't agree. Jeff has, as usual, taken a problem of some import, broken it down into easily digestible steps, provided excellent explanations, and written pretty code to show how to solve it.

    Can I get an "Excellent" people?

    Thanks Jeff. I want to be you someday when I grow up. If I decide it's worth growing up.


    Please don't go. The drones need you. They look up to you.
    Connect to me on LinkedIn
    Post #1536339
    Posted Thursday, January 30, 2014 7:40 AM
    Forum Newbie

    Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

    Group: General Forum Members
    Last Login: Thursday, January 30, 2014 8:17 AM
    Points: 2, Visits: 2
    SELECT RangeType,StartDate,EndDate,Comment
    FROM dbo.TestTable
    WHERE convert(char(10),EndDate,102) >= cast('01 Oct 2013' as datetime)
    AND convert(char(10),StartDate,102) <= cast('01 Nov 2013' as datetime)
    Post #1536349
    « Prev Topic | Next Topic »

    Add to briefcase 12345»»»

    Permissions Expand / Collapse