Condividi tramite


SqlSchema Element for EventClass/Chronicles/Chronicle (ADF)

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

Sintassi

<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)

Osservazioni

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.

Esempio

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>

Vedere anche

Riferimento

Application Definition File Reference

Altre risorse

Definizione di tabelle della cronologia degli eventi
Definizione delle cronologie per una classe di evento
Aggiornamento di istanze e applicazioni

Guida in linea e informazioni

Assistenza su SQL Server 2005