DelTrim function

The DelTrim function deletes all elements in the specified time range in a time series instance, including the delimiting timepoints. The DelTrim function is similar to the DelClip function except that the DelTrim function deletes elements and reclaims space from the end of a regular time series instance, whereas the DelClip function replaces elements with null values. The DelTrim function is also similar to the DelRange function except that the DelRange function deletes elements and reclaims space from any part of a regular time series instance.

Syntax

DelTrim(ts          TimeSeries, 
       begin_stamp datetime year to fraction(5), 
       end_stamp   datetime year to fraction(5),
       flags       integer default 0) 
returns TimeSeries;
ts
The time series to act on.
begin_stamp
The begin point of the range.
end_stamp
The end point of the range.
flags
Valid values for the flags argument are described in The flags argument values. The default is 0.

Description

If you use the DelTrim function to delete elements from the end of a time series instance, DelTrim trims off all null elements from the end of the time series and thus reduces the number of elements in the time series.

If you use the DelTrim function to delete hidden elements, or if the begin point of the range falls before the origin of the time series instance, an error is raised.

Returns

A time series with all elements in the range between the specified timepoints deleted.

Example

The following example removes all elements in a one-day range on the specified day for the specified time series instance:
update activity_stocks
set activity_data = DelTrim(activity_data,
        '2011-01-05 00:00:00.00000'
     ::datetime year to fraction(5),
        '2011-01-06 00:00:00.00000'
     ::datetime year to fraction(5))
where stock_id = 600;