SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Changing a User Defined Function into a View


Changing a User Defined Function into a View

Author
Message
Sean Lange
Sean Lange
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26313 Visits: 17553
Rick44 (8/16/2013)
Hi. That was just a small example. Yes, there could be years worth of counts. many more that 1 enrolled. Do you want me to send you larger sample data.


The small sample is fine. What I need it to understand the business rules. What would you expect as output based on the sample data you provided and how do you come up with the counts and such?

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Rick44
Rick44
SSC Rookie
SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)

Group: General Forum Members
Points: 30 Visits: 107
Hi. Thank you for getting back to me. :-D

I need to pull a count of clients enrolled in a program by month. CLT_NBR is a unique ID for each client.

•I want the total count of clients that were enrolled at the end of the month.
•So include all clients enrolled prior to the period end date. I am using there Max(EFFECT_DT) during the month to determine the count at the end of the month. The EFFECT_DT gives the status change dates. SO the Max(Effect_DT) is the last status change the client had during the month.
•I need exclude all clients disenrolled or transferred out prior to the start date and Exclude all clients who transferred in after the prior end date
•The B2H_Status variable holds the codes for the actually different types of status changes.
o 4=Enrolled
o 7= Disenrolled
o 8= Transfer In
o 9= Transfer Out

If the Period date range selected is 1/01/2013 to 3/01/2013


Total_Clients_Enrolled_Count Month Year
252 Jan 2013
247 Feb 2013
303 March 2013


Rick44
Rick44
SSC Rookie
SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)

Group: General Forum Members
Points: 30 Visits: 107
What I need it to understand the business rules. What would you expect as output based on the sample data you provided and how do you come up with the counts and such?


I hope my response is what you are looking for. Thanks again,
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search