共用方式為


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-tw,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 協助