• Rick44 (8/16/2013)


    Hi. I inherited a User Defined function I’m trying to modify and having some trouble. :crazy: I would like to modify it into a regular query and then make it into a view. The function is ufn_B2H_Enrolled_Clients_List. This function pulls a list of clients enrolled in program during a time period selected. Within ufn_B2H_Enrolled_Clients_List is a function ufn_B2H_STATUSES_THROUGH_DT . This selects the maximum status change a client had during the time range selected so if a client was enrolled then disenrolled and then enrolled again the function is not function them into the count.

    What I would like is to take ufn_B2H_Enrolled_Clients_List and turn it into a regular query/view with an output that looks like this:

    Just curious, why do you want to take this out your functions? They both look like a decent iTFV. If you are trying to get some performance gains I don't know that this will help much.

    The biggest problem we have here is that all we have to work with is a couple of queries. We don't know what these tables look like or what the objective is. If you want actual coding help you will need to post a few things:

    1. Sample DDL in the form of CREATE TABLE statements

    2. Sample data in the form of INSERT INTO statements

    3. Expected results based on the sample data

    Please take a few minutes and read the first article in my signature for best practices when posting questions.

    _______________________________________________________________

    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 http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/