CalIndex function

The CalIndex function returns the number of valid intervals in a calendar between two given time stamps.

Syntax

CalIndex(cal_name     lvarchar, 
         begin_stamp   datetime year to fraction(5), 
         end_stamp              datetime year to fraction(5)) 
returns integer;
cal_name
The name of the calendar.
begin_stamp
The begin point of the range. Must not be earlier than the calendar start date.
end_stamp
The end point of the range.

Description

The equivalent API function is ts_cal_index().

Returns

The number of valid intervals in the specified calendar between the two time stamps.

Example

The following query returns the number of intervals in the calendar daycal between 2011-01-03 and 2011-01-05:
select CalIndex('daycal',
      '2011-01-03 00:00:00.00000',
      '2011-01-05 00:00:00.00000')
    from systables
    where tabid = 1;