Compartir a través de


SqlSchema Element for EventClass/Chronicles/Chronicle (ADF)

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

Sintaxis

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

Notas

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.

Ejemplo

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>

Vea también

Referencia

Application Definition File Reference

Otros recursos

Definir tablas de crónica de eventos
Definir crónicas para una clase de evento
Actualizar instancias y aplicaciones

Ayuda e información

Obtener ayuda sobre SQL Server 2005