다음을 통해 공유


SqlSchema Element for EventClass/Chronicles/Chronicle (ADF)

Contains the Transact-SQL statements that define an event chronicle table.

구문

<EventClasses>
    <EventClass>
        ...
        <Chronicles>
            <Chronicle>
                ...
                <SqlSchema>

Element Characteristics

Characteristic Description

Data type and length

None.

Default value

None.

Occurrence

Required once per Chronicle element.

Updates

Cannot be added or deleted.

Element Relationships

Relationship Elements

Parent element

Chronicle Element for EventClass/Chronicles (ADF)

Child elements

SqlStatement Element for EventClass/Chronicles/Chronicle/SqlSchema (ADF)

주의

A SqlSchema element contains SqlStatement elements, which define batches of Transact-SQL statements. To define multiple chronicles for the event class, use multiple SqlStatement elements.

When you define an event chronicle, add code to drop, rename, or skip creating the chronicle if the table already exists. If the table exists when Notification Services attempts to update the application, you will receive an "object exists" error and the update will fail.

When creating chronicles, make sure to use the schema defined for the application database. If no schema is defined, the default schema is dbo.

The following example shows how to drop an existing event chronicle table named dbo.StockEventChron, and then re-create the event chronicle table. The table contains two columns, StockSymbol and StockPrice.

<SqlSchema>
    <SqlStatement>
    IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_NAME = 'StockEventsChron'
            AND TABLE_SCHEMA = 'dbo')
        DROP TABLE dbo.StockEventsChron;
    </SqlStatement>
    <SqlStatement>
    CREATE TABLE dbo.StockEventsChron
    (
    StockSymbol char(10),
    StockHighPrice money
    PRIMARY KEY (StockSymbol)
    );
    </SqlStatement>
</SqlSchema>

The following example shows how to create the event chronicle table only if a table named dbo.StockEventChron does not exist.

<SqlSchema>
    <SqlStatement>
    IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_NAME = 'StockEventsChron'
            AND TABLE_SCHEMA = 'dbo')
        CREATE TABLE dbo.StockEventsChron
        (
        StockSymbolOne char(10),
        StockHighPrice money
        PRIMARY KEY (StockSymbolOne)
       );
    </SqlStatement>
</SqlSchema>

참고 항목

참조

Application Definition File Reference

관련 자료

이벤트 기록 테이블 정의
이벤트 클래스에 대한 기록 정의
인스턴스 및 응용 프로그램 업데이트

도움말 및 정보

SQL Server 2005 지원 받기