ComputedField Element (ADF)

Provides a location for defining a computed notification class field.

语法

<NotificationClasses>
    <NotificationClass>
        ...
        <Schema>
            ...
            <ComputedFields>
                <ComputedField>

Element Characteristics

Characteristic Description

Data type

None.

Default value

None.

Occurrence

Required once or more per ComputedFields element.

Updates

Can be added and deleted when updating the application.

Element Relationships

Relationship Elements

Parent element

ComputedFields Element (ADF)

Child elements

FieldName Element for NotificationClass/Schema/ComputedFields/ComputedField (ADF)

SqlExpression Element for ComputedField (ADF)

DigestGrouping Element for ComputedField (ADF)

备注

Computed fields are never stored in the notifications table. Instead, they are computed immediately before the notification data is passed to the content formatter.

Computed fields allow you to make use of the calculation facilities of Microsoft SQL Server. Use of computed fields can improve the performance of your notification application, can reduce the work that you must do in the content formatter, and enables you to use the rich formatting and conversion capabilities in Transact-SQL.

ms145901.note(zh-cn,SQL.90).gif重要提示:
If you add or delete a ComputedField element, updating the application deletes and re-creates the notification class to which it corresponds. This includes dropping and re-creating the SQL Server tables used by this notification class. Make sure to back up your application database before updating the application.

示例

The following example shows a populated ComputedField element. The computed field converts the stock price into a formatted string.

<ComputedField>
    <FieldName>FormattedStockPrice</FieldName>
    <SqlExpression>CONVERT(NVARCHAR(10), StockPrice, 1)
    </SqlExpression>
</ComputedField>

请参阅

参考

Application Definition File Reference

其他资源

CAST 和 CONVERT (Transact-SQL)
定义通知架构
更新实例和应用程序

帮助和信息

获取 SQL Server 2005 帮助