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 gaps between termination date and next enrollment date and filter by gap >= 45 days for year 2013 Expand / Collapse
Author
Message
Posted Saturday, July 12, 2014 8:25 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 7:39 AM
Points: 19, Visits: 124
Hi Lynn!

That is a good question. I was assuming that if the enrollment date is for instance 2/1/2013, that's when the enrollment starts and if termination date is on 12/31/2013, that day is still counted as being enrolled, but I'm not sure if it's actually so. I would say yes, so then We have to add 1 day, correct?

I will have to confirm on Monday.

Sorry for not having a definitive answer

I will review the explanation of your code, I really appreciate you tsking the time to help me!!!

I hsve found you and autoexcrement to be so helpful!!!

Thank you so much!!!


Tammy
Post #1591972
Posted Saturday, July 12, 2014 8:35 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 155, Visits: 586
Apologies that I misunderstood what you needed. Hopefully Lynn will be able to see you to the finish line. :)


"If I had been drinking out of that toilet, I might have been killed." -Ace Ventura
Post #1591974
Posted Saturday, July 12, 2014 8:45 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:56 PM
Points: 23,400, Visits: 32,256
Tammy-274861 (7/12/2014)
Hi Lynn!

That is a good question. I was assuming that if the enrollment date is for instance 2/1/2013, that's when the enrollment starts and if termination date is on 12/31/2013, that day is still counted as being enrolled, but I'm not sure if it's actually so. I would say yes, so then We have to add 1 day, correct?

I will have to confirm on Monday.

Sorry for not having a definitive answer

I will review the explanation of your code, I really appreciate you tsking the time to help me!!!

I hsve found you and autoexcrement to be so helpful!!!

Thank you so much!!!


Tammy


Well, I am going with my experience with insurance and say the termination date is the last day of coverage.

Did you also read my explanation regarding the ID you said was 46 and was actually 45 when you look at the dates knowing (or assuming) what are dates of coverage and what aren't.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1591975
Posted Saturday, July 12, 2014 9:36 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 7:39 AM
Points: 19, Visits: 124
Hi Lynn and autoexcrement!

@autoexcrement, thank you so much for your time in helping me!!!

@Lynn, yes, I saw your explanation, and regarding the 46 days it does make sense what you are saying and that's what I will go by!

So by changing the code to the last one you posted to account for leap year, that should make it work for any working year I use, correct?

Thanks a lot for such quick replies!!!!

Tammy
Post #1591976
Posted Sunday, July 13, 2014 7:19 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:56 PM
Points: 23,400, Visits: 32,256
Tammy-274861 (7/12/2014)
Hi Lynn and autoexcrement!

@autoexcrement, thank you so much for your time in helping me!!!

@Lynn, yes, I saw your explanation, and regarding the 46 days it does make sense what you are saying and that's what I will go by!

So by changing the code to the last one you posted to account for leap year, that should make it work for any working year I use, correct?

Thanks a lot for such quick replies!!!!

Tammy


Yes, now that I programmatically calculate the number of days in the year it will work for any working year you use.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1591995
Posted Monday, July 14, 2014 6:57 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 7:39 AM
Points: 19, Visits: 124
Good morning, Lynn!!!


I'm happy to say it works like a charm!!!!

Your explanation is also really useful so I can understand what is going on.

I have a final question, what are you using the dayslapsed for?

I see it's the different between numdays and daysinyear, but is it being used or is this an extra check?

Thanks a lot for all your help with my issue!!!

Tammy
Post #1592166
Posted Monday, July 14, 2014 7:52 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:56 PM
Points: 23,400, Visits: 32,256
Not really using it. Most of the columns returned by me are just for FYI. You should adjust the code as needed for your application.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1592186
Posted Monday, July 14, 2014 7:56 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 7:39 AM
Points: 19, Visits: 124
Lynn,

Thank you so much for all your help!

I will mark your last query as the solution to my problem!!!


I really appreciate all your time invested in helping me and your quick responses.

Take care of yourself there!!!!


Tammy
Post #1592187
« Prev Topic | Next Topic »

Add to briefcase «««12345

Permissions Expand / Collapse