Split a Date Range N days into N row, possible?

hi all,
i am planning to create a view for my peoplesoft custom component
Record structure
Employee id | Date From | Date To
123 | 10-Aug-2010 | 13-Aug-2010
Can it convert into a view with the following row?
Employee | Date
123 | 10-Aug-2010
123 | 11-Aug-2010
123 | 12-Aug-2010
123 | 13-Aug-2010
Thanks for the help

SBH wrote:
Try it as below
WITH C AS
SELECT 123 EMPID,TO_DATE('10-Aug-2010','DD-MM-YYYY') STDT,TO_DATE('13-Aug-2010','DD-MM-YYYY') ENDT
FROM DUAL
SELECT EMPID, DT
FROM (SELECT EMPID, STDT+LEVEL-1 DT
FROM C
CONNECT BY LEVEL <= (ENDT-STDT+1)
SQL> /
EMPID DT
123 10-AUG-10
123 11-AUG-10
123 12-AUG-10
123 13-AUG-10
Works ok for a single row of data, but not if there are multiples with different date ranges. For that you'd need something more along the lines of...
SQL> ed
Wrote file afiedt.buf
  1  WITH c AS
  2    (
  3    select 123 as empid, to_date('10-Aug-2010','DD-MM-YYYY') as stdt, to_date('13-Aug-2010','DD-MM-YYYY') as endt from dual union all
  4    select 234, to_date('17-Aug-2010','DD-MM-YYYY'), to_date('25-Aug-2010','DD-MM-YYYY') from dual
  5    )
  6  -- END OF TEST DATA
  7  select empid, stdt+x.rn-1 as dt
  8  from c, (select rownum as rn from dual connect by rownum <= (select max(endt-stdt+1) as mx_rn from c)) x
  9  where stdt+x.rn-1 <= endt
10* order by empid, stdt+x.rn-1
SQL> /
     EMPID DT
       123 10/08/2010 00:00:00
       123 11/08/2010 00:00:00
       123 12/08/2010 00:00:00
       123 13/08/2010 00:00:00
       234 17/08/2010 00:00:00
       234 18/08/2010 00:00:00
       234 19/08/2010 00:00:00
       234 20/08/2010 00:00:00
       234 21/08/2010 00:00:00
       234 22/08/2010 00:00:00
       234 23/08/2010 00:00:00
       234 24/08/2010 00:00:00
       234 25/08/2010 00:00:00
13 rows selected.
SQL>

Similar Messages

  • Need to Convert Comma separated data in a column into individual rows from

    Hi,
    I need to Convert Comma separated data in a column into individual rows from a table.
    Eg: JOB1 SMITH,ALLEN,WARD,JONES
    OUTPUT required ;-
    JOB1 SMITH
    JOB1 ALLEN
    JOB1 WARD
    JOB1 JONES
    Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
    But I need to use a database independent solution
    Thanks in advance for your valuable inputs.
    George

    Go for ETL solution. There are couple of ways to implement.
    If helps mark

  • Exceeding data allowance 2 days into the billing cycle

    I'm 2 days into my new billing cycle and one of my iphones on AT&T and another on Verizon have both triggered a warning from the carrier that I am close to exceeding my data allowance on my 2GB data plans.
    I've never exceed with these phones before and I'm unaware of anything new that I am doing with them.
    Both are Iphone 4S's.
    /Chris

    Could be a lot of things.  For example, if you use iTunes Match you might want to check Settings>Music>Use Cellular Data and set to Off to restrict it to wi-fi.  There might also be an email stuck in your Outbox that Mail is constantly trying to send.  You might also check to see if there is a subscribed podcast that is stuck trying to download.  If you are trying to activate iMessage (or FaceTime), perhaps your phone(s) are contstantly trying to send a silent sms to the iMessage activation server.
    Guess I would try force-closing all of your apps and resetting your phone: double-tap the home button, tap and hold any app in the list at the bottom until it wiggles, tap next to all of the apps to close them.  Then reset your phone: hold the on/off and home buttons at the same time until you see the Apple logo (ignore the off slider that appears first), then release.  Also check the items above (stuck email trying to send, stuck podcast trying to download, etc.).  If it persists, you'll probably have to try closing all but a few apps, then checking your data usage after a period of time, until you can isolate the offending data hog.

  • Date range selection from session/server variables - possible solution

    I've recently been creating some reports who'se selection is based on the contents of a session variable, using this against a date field. Thought I'd share with everyone how I did it.
    1/ Create a server/static variable called DATE_FORMAT who'se contents are 'dd/mm/yy' . Note, should include the single quotes.
    2/ Create 2 session variables that represent the beginning/end date range for your selection you are after - in my case, it was the first & last date of the previous month, PREVIOUS_PERIOD_FROM and PREVIOUS_PERIOD_TO
    3/ In the selection, add a filter on the date field in question, set the Operator as "is between".
    4/ for each of the 2 valaues, select Add->SQL expression and enter:
    EVALUATE('TO_DATE(%1,%2)',VALUEOF(NQ_SESSION."PREVIOUS_PERIOD_FROM"),VALUEOF("DATE_FORMAT"))
    and
    EVALUATE('TO_DATE(%1,%2)',VALUEOF(NQ_SESSION."PREVIOUS_PERIOD_TO"),VALUEOF("DATE_FORMAT"))

    HI,
           U can check the Select Quert by using IN s_option.
    Like eg:--
        Select * form Zemp where empno in s_empno.
    Hope this example will help u...
    here Zemp is a table...... empno is a field     s_empno is a Select-option.
    Thanks and rEgards
    Suraj S Nair

  • Script or operation to split a date and time channel into two channels

    Hi There,
    I have a channel that contains a range of dates and times.
    I would like to split that channel into two channels - one with date and one with time.
    Any suggestions?

    Sorry:    Here is the attachment......
     and Sample of the data
    Comment:
    Date
    Time
    AIR TEMP
    AIR TEMP SP
    TAC PTC
    Load Temp
    Channel 4
    UUT Front TC
    1/20/2015
    12:30:05
    80.3
    79.3
    59.4
    0
    0
    62.9
    1/20/2015
    12:30:11
    80.1
    79.3
    59.5
    0
    0
    63
    1/20/2015
    12:30:17
    80
    79.3
    59.6
    0
    0
    63
    1/20/2015
    12:30:23
    79.9
    79.3
    59.7
    0
    0
    63.1
    1/20/2015
    12:30:29
    79.7
    79.3
    59.7
    0
    0
    63.2
    1/20/2015
    12:30:35
    79.7
    79.3
    59.8
    0
    0
    63.4
    1/20/2015
    12:30:41
    79.6
    79.3
    59.9
    0
    0
    63.4
    1/20/2015
    12:30:47
    79.6
    79.3
    60
    0
    0
    63.5
    1/20/2015
    12:30:53
    79.5
    79.3
    60
    0
    0
    63.5
    1/20/2015
    12:30:59
    79.5
    79.3
    60.2
    0
    0
    63.6
    1/20/2015
    12:31:05
    79.6
    79.3
    60.3
    0
    0
    63.7
    1/20/2015
    12:31:11
    79.6
    79.3
    60.3
    0
    0
    63.7
    1/20/2015
    12:31:17
    79.6
    79.3
    60.5
    0
    0
    63.8
    1/20/2015
    12:31:23
    79.7
    79.3
    60.6
    0
    0
    63.9
    1/20/2015
    12:31:29
    79.7
    79.3
    60.7
    0
    0
    64
    1/20/2015
    12:31:35
    79.8
    79.3
    60.8
    0
    0
    64.1
    1/20/2015
    12:31:41
    79.8
    79.3
    60.9
    0
    0
    64.3
    1/20/2015
    12:31:47
    79.8
    79.3
    61
    0
    0
    64.4
    1/20/2015
    12:31:53
    79.7
    79.3
    61.1
    0
    0
    64.4
    1/20/2015
    12:31:59
    79.7
    79.3
    61.2
    0
    0
    64.5
    1/20/2015
    12:32:05
    79.7
    79.3
    61.3
    0
    0
    64.6
    1/20/2015
    12:32:11
    79.6
    79.3
    61.4
    0
    0
    64.7
    1/20/2015
    12:32:17
    79.6
    79.3
    61.5
    0
    0
    64.8
    1/20/2015
    12:32:23
    79.6
    79.3
    61.6
    0
    0
    64.8
    1/20/2015
    12:32:29
    79.5
    79.3
    61.6
    0
    0
    64.8
    1/20/2015
    12:32:35
    79.5
    79.3
    61.7
    0
    0
    64.8
    1/20/2015
    12:32:41
    79.5
    79.3
    61.8
    0
    0
    64.9

  • To get all the required data in a column into a row

    Hi,
    I have a table T which contains columns Id,Name,Type
    The structure of the table will be like
    Id     Name     Type
    1     ABC     S
    2     DEF     F
    1     ADR     F
    3     ASD     D
    1     DCH     C
    1     ADE     S
    2     CDF     D
    I need an output like this
    Id     Types
    1     S,F,C
    2     F,D
    3     D
    Can any one help me in this regard. It will be thankful.
    Thank You
    11081985

    Hi,
    That's called String Aggregation . The following page shows several ways to do it:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    Which way is best for you? That depends on your requirements (e.g., Is order important? What to do about duyplicates?) and your version of Oracle.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Need work around to split date range into months

    Hi All,
    I have a requirement to split the data range in source table to months.
    here is the source table
    ID Sdate Edate Code
    ===============================
    501 1/4/2009 4/30/2009 AH
    501 5/1/2009 9/30/2009 AB
    502 1/1/2014 5/31/2014 AC
    Here is my target
    ID Sdate Edate Code
    ================================
    501 1/4/2009 1/31/2009 AH
    501 2/1/2009 2/28/2009 AH
    501 3/1/2009 3/31/2009 AH
    501 4/1/2009 4/30/2009 AH
    501 5/1/2009 5/31/2009 AB
    501 6/1/2009 6/30/2009 AB
    501 7/1/2009 7/31/2009 AB
    501 8/1/2009 8/31/2009 AB
    501 9/1/2009 9/30/2009 AB
    502 1/1/2014 1/31/2014 AC
    502 2/1/2014 2/28/2014 AC
    502 3/1/2014 3/31/2014 AC
    502 4/1/2014 4/30/2014 AC
    502 5/1/2014 5/31/2014 AC
    Please provide some input.
    Thanks a lot in advance.

    That means your database is in a different locale than mine. When I select cast(Edate as varchar), I get the date returned in the format 'YYYY-MM-DD'. That's why I use(left(cast(Edate as varchar),4) + right(left(cast(Edate as varchar),7),2) to get it the format 'YYYYMM' before converting it into an integer.
    Your database most probably returns dates in a format like D/MM/YYYY. That's the reason for the error you get. You'll have to select (right(cast(Edate as varchar),4) + left(right(cast(Edate as varchar),7),2) to obtain the same results as I do.
    Alternatively, you can use the convert function to obtain the same results:
         select max(
         cast(left(convert(varchar,Edate,102),4) + right(left(convert(varchar,Edate,102),7),2) as int) + 1 -
         cast(left(convert(varchar,Sdate,102),4) + right(left(convert(varchar,Sdate,102),7),2) as int))
         FROM src_split'
    It's always good practice to test the SQL-statements in your database client first before including them in a DS script.
    Also, I suddenly realise this statement will only return the correct result when your Edate and Sdate are always within the same year. If that's not the case, but the gap between Edate and Sdate is always less than 10 years, change your statement to:
         select max(
         cast(left(convert(varchar,Edate,102),4) + right(left(convert(varchar,Edate,102),7),2) as int) + 1 -
         cast(left(convert(varchar,Sdate,102),4) + right(left(convert(varchar,Sdate,102),7),2) as int)) % 88
         FROM src_split'

  • Split date range without Calendar table

    Hi guys!
    Is there any way to split date ranges (to days / hours / minutes) in one table without using Calendar table (without joining 2 tables)?
    Reason I'm asking this is because we have a huge Fact table (500+ million records) and joining small Calendar table and this huge Fact table takes considerable amount of time.
    So far we tried:
    Join 2 tables (Fact and Calendar)
    Cross Applying Calendar and table-valued function (that returns necessary measures from Fact table)
    and both approaches took few minutes for 1 day to complete.
    Most successful test we had so far was using CLR and executing table-valued functions in parallel for different 15 minute periods. This way we were able to get the results in 3-4 seconds.
    Anyway, is there any effective pure T-SQL way to accomplish this?
    Thanks in advance,
    Miljan

    Try using a temporary table rather than table variable.. You can have a CI on the date column.
    or
    declare @PeriodStart datetime2(0) = '2013-01-05 00:00:00'
    declare @PeriodEnd datetime2(0) = '2013-01-05 02:00:00'
    select T.PeriodStart, T.PeriodEnd, count(Column1)as count1, sum(Column2)as sum1
    from Fact F with(nolock)WHERE F.[Start]>= '19000101' AND <=@PeriodStartand F.[End] >= @PeriodEnd and F.[End] <='20200101'
    group by T.PeriodStart, T.PeriodEnd
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Calculating Business Days in a Date Range

    I have two questions:
    1. Does anyone know a better formula for calculating business days in totals?
    I am currently using the formula in https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/701a52c3-6b1e-2b10-21b3-a6e101be1a0f
    I tailored to my needs.  However, there are still a lot of manual maintenance every year. 
    2. I have many reports that need the formula.  It is very consuming to update the formula in each report.  Does anyone know a better way to do it? 
    I use Crystal XI. 11.0.0.895.  We do have a Crystal Enterprise server hosted in another department.

    Not sure if this is any simpler but you could save this as a custom function, that way you will have to modify it once a year for the holidays.
    numbervar days;
    datevar date1 := minimum({?My Parameter});
    datevar date2 := maximum({?My Parameter});
    days := DateDiff ("d", date1, date2) -
    DateDiff ("ww", date1, date2, crSaturday) -
    DateDiff ("ww", date1, date2, crSunday);    // this will give you the number of business days
                                                        // (excluding Saturdays and Sundays) for a given date range.
    // then, for each holiday, you can enter lines like this
    if date(2008,01,01) in {?My Parameter} then days := days - 1;
    // The final tally of DAYS should give you the total business days in a date range.
    totext(days,0);
    where {?My Parameter} is the date range.

  • Data split into 2 rows

    BW gurus,
       Hope all are fine. I have an ODS (0FIA_DS13) feeding from two data sources.
    They are 0FI_AA_12 and 80FIA_DS11( data mart of 0FIA_DS11).
       I enhanced data source 0FI_AA_12 and added 2 extra char fields. After loading data , the data is not emerging into one row. Data coming from 0FI_AA_12 and 80FIA_DS11 coming in separate lines in the data target(0FIA_DS13). Before enhancement was OK. After enhancement this problem is happening.
      Please advice.
    Any advice/comments greatly appreciated.
    Many thanks

    Hi Manoj,
    Based on ur scenario, u can ignore source system in reporting as it do not make any sense, if u do not map  this field in to the Multiprovider, it wont make any problem. ( u can also make a variable on the source system and putting source sytem in filter in query, so that user can choose source if needed.)
    As u are reporting based on business facts ( numerical values ), u just need to tick on source and facts, u need not to tick for both sources.
    Let me make it more clear, u are clubbing business facts from both sources (ODS's), if u tick on both sources business facts will be summed up and reporting will be wrong, so u have to decide about perticular business facts for required source and map the fields ( identify ) in multiprovider.
    Regards.

  • How to compare date range ?

    hi, good day , i need some idea on my issue
    scenario :
    i need to know if given a new date range, and check whether this new date range is fall into between the date range
    for example ,
    new_start_date = 15/05/2006, new_end_date = 01/09/2006
    existing start_date = 20/02/2006 , existing end_date = 11/07/2006 so in this case , new start and end date have fall into existing start and end date range, cause it should not interlapse the date range
    - in short, new start_date and end_date cannot in between of existing start_date and end_date , how i write a algorithm on this ? thank you for guidance

    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    * DateSample.java
    * Created on February 9, 2006, 10:09 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    * @author krichard
    public class DateSample {
         *  new_start_date = 15/05/2006, new_end_date = 01/09/2006
         *  existing start_date = 20/02/2006 , existing end_date = 11/07/2006
        /** Creates a new instance of DateSample */
        public DateSample() {
            String existingStartDateStr = "20/02/2006" ;
            String existingEndDateStr = "11/07/2006" ;
            String newStartDateStr = "15/05/2006" ;
            String newEndDateStr = "01/09/2006" ;
            SimpleDateFormat dateUtil = new SimpleDateFormat("dd/MM/yyyy") ;
            try {
                Date existingStartDate = dateUtil.parse(existingStartDateStr);
                Date existingEndDate = dateUtil.parse(existingEndDateStr);
                Date newStartDate = dateUtil.parse(newStartDateStr);
                Date newEndDate = dateUtil.parse(newEndDateStr);
                boolean newStartCheck = existingStartDate.before(newStartDate) && existingEndDate.after(newStartDate);
                boolean newEndCheck = existingStartDate.before(newEndDate) && existingEndDate.after(newEndDate);
                boolean inBetween = newStartCheck & newEndCheck ;
                System.out.println("Existing::"+existingStartDate+" - " +existingEndDate);
                System.out.println("New::"+newStartDate+" - " +newEndDate);
                System.out.println("It is "+inBetween+" that the new dates are in between the existing ones.");
            } catch (ParseException ex) {
                ex.printStackTrace();
         * @param args the command line arguments
        public static void main(String[] args) {
            new DateSample() ;
    }

  • Regarding splitting of dates

    hi i want to split the dates that will be entered by the user on the monthly basis.if there is any way of diing it please le me know
    suppose i have a strting date as 15.06.2001 and the end date as 31.05.2002
    then the output that i want is
    15.06.2001 to 30.06.2001
    01.07.2001 to 31.07.2001
    01.08.2001 to 31.08.2001
    01.09.2001 to 30.09.2001
    01.10.2001 to 31.10.2001
    01.11.2001 to 30.11.2001
    01.12.2001 to 31.12.2001
    01.01.2001 to 31.01.2002
    01.02.2002 to 31.02.2002
    01.03.2002 to 28.03.2002
    01.04.2002 to 31.04.2002
    01.04.2002 to 30.05.2002
    any code or functional module to split the date ranges in this type of format will do
    thanks and regards
    ashish

    Pl try the following code.
    *& Report  ZDATES                                                      *
    report  zdates.
    parameters: p_begda type sydatum,
                p_endda type sydatum.
    types:
          begin of typ_dates,
           begda type sydatum,
           endda type sydatum,
          end of typ_dates.
    data: t_dates type standard table of typ_dates,
          rec_dates like line of t_dates.
    do.
      if sy-tabix eq 1.
        rec_dates-begda = p_begda.
      endif.
      call function 'RP_LAST_DAY_OF_MONTHS'
        exporting
          day_in            = rec_dates-begda
        importing
          last_day_of_month = rec_dates-endda.
      append rec_dates to t_dates.
      if  rec_dates-endda = p_endda.
        exit.
      else.
        rec_dates-begda = rec_dates-endda + 1.
      endif.
    enddo.
    loop at t_dates into rec_dates.
      write: / rec_dates-begda,rec_dates-endda.
    endloop.
    ~Suresh

  • Date range in report output

    Hi Abaper,
    I have a requirment to display range of date in report output . I have fixed output to 7 days.
    when ever i input date range 7 days its display fine but when i input 3 days the report output date is display upto 3 is fine but in 5th to 7th column date should not display correct format.
    below is my code.
    date = p_date-low.
    wa_date-dat = date.
    APPEND wa_date TO it_date.
    CLEAR  wa_date.
    IF date LT p_date-high.
      date1 = p_date-low + 1.
      wa_date-dat = date1.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date1 LT p_date-high.
      date2 = date1 + 1.
      wa_date-dat = date2.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date2 LT p_date-high.
      date3 = date2 + 1.
      wa_date-dat = date3.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date3 LT p_date-high.
      date4 = date3 + 1.
      wa_date-dat = date4.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date4 LT p_date-high.
      date5 = date4 + 1.
      wa_date-dat = date5.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    IF date5 LT p_date-high.
      date6 = date5 + 1.
      wa_date-dat = date6.
      APPEND wa_date TO it_date.
      CLEAR  wa_date.
    ENDIF.
    Can any one help me on this issue.
    Thanks in Advance.
    Thanks & Regards,
    Amit

    Hi Amit,
    pls see the code below:
    date = p_date-low.
    wa_date-dat = date.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    IF date LT p_date-high AND date is not initial.
    date1 = p_date-low + 1.
    wa_date-dat = date1.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    IF date1 LT p_date-high AND date1 is not initial.
    date2 = date1 + 1.
    wa_date-dat = date2.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    IF date2 LT p_date-high AND date2 is not initial.
    date3 = date2 + 1.
    wa_date-dat = date3.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    IF date3 LT p_date-high.
    date4 = date3 + 1.
    wa_date-dat = date4.
    APPEND wa_date TO it_date.
    CLEAR wa_date.
    ENDIF.
    Pls add the condition also in ur check for all the IF conditions..and just see if it works...
    Keerthi

  • Interactive Column Chart w/Sliding Date Range?

    I've created a stacked column chart in Numbers 3.0. It displays stacked data for a one week period using seven columns, one for each weekday. Is it possible to make an interactive version of this chart that would still display all seven stacked columns, but allow me to use a slider control to adjust the date range? Ideally I'd like the slider to adjust the date range one day at a time, so I have a rolling 7 day view of my data.
    Any suggestions?

    Data is the original data table.
    Set Start is a four cell table with A2 set as a Slider, range 1 - 100, and the formula below in B2:
    B2: =OFFSET(Data :: $A$1,A,0)
    Cell B2 is for display only. It offers live feedback to the user while setting the beginning date for the chart, but is not used in the calculations in For Chart.
    For Chart is a Summary table containing the headers shown.
    There is one formula in this table, entered in A2, then filled right to D2, and down to row 8:
    A2: =OFFSET(Data :: $A$1,ROW()-2+Set Start :: $A$2,COLUMN()-1)
    The chart draws its information from For Chart. Here is a second chart image using the same data table. The only change is that the user has reset the slider to a larger value. The start date on this chart is the same as the last date on the one above.
    Regards,
    Barry

  • How to produce the effect of a date range inner join without actually doing one

    I have a T-SQL inner date range join that has done the job, but now that I am starting to learn about query optimization (as in just starting), I'm scratching my head on how to make it better. I see the non-equi join as being the issue because the optimizer
    scans through the entire table.  As you will see from the DDL code pasted below, there are no possible equi-joins. The enrollment history table has about 6000 rows so far, whereas the calendar table has only 10 so far, but is subject to change, which
    is why I have it as a table join.
    Another way to describe this is in the necessary outcome, which you see in the "Is_FAY" column in the Select statement. For each row in the Enrollment History table, I use the Case statement to determine whether the pair of Entry and Exit dates
    are within the Calendar date ranges (and if so, which row the match is found). There are no nulls in either table by design.
    At first, I thought of adding a non-clustered index, but the credible resources and blogs are mixed. Some sources say to use them, others say not to use them, and the remainder are on the fence. That and the
    fact that I drop and recreate the table every 24 hours (there are many updates to the Black Box) makes me very leery about having indices other than the primary key.
    I have pasted DDL language below with sample data.  Change the "Use Learning_Curve" statement to whatever database you want to use -- the rest will run as written.
    Now that I've given you some background and what I hope to accomplish, I hope that someone has encountered this issue before and can suggest an avenue of further inquiry, because I am out of usable research sources and ideas. 
    Thank you
    USE Learning_Curve;
    GO
    IF OBJECT_ID('dbo.Enrollment_History', 'U') IS NOT NULL
    DROP TABLE dbo.Enrollment_History;
    CREATE TABLE dbo.Enrollment_History
    (ID INT NOT NULL identity(1, 1) PRIMARY KEY,
    Campus_ID INT NOT NULL,
    Student_ID INT NOT NULL,
    Entry_Date DATE NOT NULL,
    Exit_Date DATE NOT NULL);
    INSERT INTO dbo.Enrollment_History
    VALUES (1, 103934, '2014-08-11', '2015-01-10'),
    (1, 102912, '2014-09-10', '2015-05-10'),
    (1, 199234, '2014-08-07', '2015-05-01');
    IF OBJECT_ID('dbo.Calendar_FAY_Dates', 'U') IS NOT NULL
    DROP TABLE dbo.Calendar_FAY_Dates;
    CREATE TABLE dbo.Calendar_FAY_Dates
    (ID INT NOT NULL identity(1, 1) PRIMARY KEY,
    FY VARCHAR(4) NOT NULL,
    Start_B DATE NOT NULL,
    Start_E DATE NOT NULL,
    End_B DATE NOT NULL,
    End_E DATE NOT NULL);
    INSERT INTO dbo.Calendar_FAY_Dates
    VALUES ('FY14', '2013-08-05', '2013-08-29', '2014-04-30', '2014-05-15'),
    ('FY15', '2014-08-07', '2014-08-28', '2015-04-30', '2015-05-15');
    SELECT eh.ID,
    eh.Campus_ID,
    eh.Student_ID,
    eh.Entry_Date,
    eh.Exit_Date,
    cfd.FY,
    case
    when eh.Entry_Date >= cfd.Start_B
    and eh.Entry_Date <= cfd.Start_E
    and eh.Exit_Date >=cfd.End_B
    and eh.Exit_Date <= cfd.End_E
    then 1 else 0 end as Is_FAY
    FROM dbo.Enrollment_History eh
    inner join dbo.Calendar_FAY_Dates cfd
    on eh.Entry_Date >= cfd.Start_B
    and eh.Exit_Date <= cfd.End_E

    This definitely a case where an indexes on the two tables will speed things up significantly. 
    It's also one of those strange cases where you can't really rely on the numbers you see in the execution plan. To really get an idea the impact to need to actually time the query...
    For example. Running your final query with out any additional indexes took ~4,000 microseconds...
    Adding the following index, dropped that time down to ~3,000 microseconds...
    CREATE NONCLUSTERED INDEX ix_Enrollment_History_EntryDates ON dbo.Enrollment_History (
    Entry_Date,
    Exit_Date)
    INCLUDE (
    ID,
    Campus_ID,
    Student_ID)
    WITH (DATA_COMPRESSION = PAGE)
    Adding the following index (and keeping the 1st) dropped it again, down to ~2,000 microseconds
    CREATE NONCLUSTERED INDEX ix_CalendarFAYDates_Detes ON dbo.Calendar_FAY_Dates (
    Start_B,
    End_E)
    INCLUDE (
    Start_E,
    End_B,
    ID,
    FY)
    WITH (DATA_COMPRESSION = PAGE)
    Keep in mind that 5 rows of data doesn't even begin to provide an accurate representation of read execution times against actual production data (the smallest changes in background processes on my computer caused the time to vary pretty drastically between
    executions).
    Anyway, the following is a quick & dirty way to test execution times when you're query tuning or checking the impact of different indexes on a query.
    DECLARE @b DATETIME2(7) = SYSDATETIME()
    SELECT eh.ID,
    eh.Campus_ID,
    eh.Student_ID,
    eh.Entry_Date,
    eh.Exit_Date,
    cfd.FY,
    case
    when eh.Entry_Date >= cfd.Start_B
    and eh.Entry_Date <= cfd.Start_E
    and eh.Exit_Date >=cfd.End_B
    and eh.Exit_Date <= cfd.End_E
    then 1 else 0 end as Is_FAY
    FROM dbo.Enrollment_History eh
    inner join dbo.Calendar_FAY_Dates cfd
    on eh.Entry_Date >= cfd.Start_B
    and eh.Exit_Date <= cfd.End_E
    SELECT DATEDIFF(mcs, @b, SYSDATETIME())
    HTH,
    Jason
    Jason Long

Maybe you are looking for