Expand function

The Expand function expands the specified calendar pattern into the destination units, which must have a smaller interval unit than the interval unit of the specified calendar pattern.

Syntax

Expand (cal_patt  CalendarPattern, 
        interval  lvarchar) 
returns CalendarPattern; 
cal_patt
The calendar pattern to expand.
interval
The destination time interval: second, minute, hour, day, week, or month.

Description

When a month is expanded, it is assumed to have 30 days.

Returns

The expanded calendar pattern.

Example

The following statements convert a daily calendar pattern into an hourly calendar pattern:
select * from CalendarPatterns
                where cp_name = 'workweek_day';

cp_name         workweek_day
cp_pattern         {1 off,5 on,1 off},day

select Expand(cp_pattern, 'hour')
              from CalendarPatterns
            where cp_name = 'workweek_day';

(expression) {24 off,120 on,24 off},hour