Rule functions

You can use the following functions in transmission rules:

Syntax Description
DATEADD( datepart, count, datetime )

Returns a datetime produced by adding several date parts to a datetime. The datepart can be one of year, quarter, month, week, day, hour, minute, or second. For example, the following example adds two months, resulting in the value 2006-07-02 00:00:00.0:

DATEADD( month, 2, '2006/05/02' )
DATEPART( datepart, date )

Returns the value of part of a datetime value. The datepart can be one of year, quarter, month, week, day, dayofyear, weekday, hour, minute, or second. For example, the following example gets the month May as a number, resulting in the value 5:

DATEPART( month, '2006/05/02' )
DATETIME( string ) Converts a string value to a datetime. The string must have the format 'yyyy-mm-dd hh:nn:ss'.
LENGTH( string ) Returns the number of characters in a string.
SUBSTRING( string, start, length ) Returns a substring of a string. The start is the start position of the substring to return, in characters. The length is the length of the substring to return, in characters.
Example

The following delete rule deletes all messages that entered a final state more than 10 days ago:

START TIME '06:00:00' every 1 hours = ias_Status >= ias_FinalState \
  AND ias_StatusTime < DATEADD( day, -10, ias_CurrentTimestamp) \ 
  AND ias_TransmissionStatus = ias_Transmitted