Defining a SQL Server Event Provider

To use the Microsoft SQL Server event provider, you must define a hosted event provider in the application definition. This topic documents the property values and the arguments required by the SQL Server event provider.

Note

The SQL Server event provider queries a database. The account used by the Windows service or application that runs the event provider must be able to connect to the database and must have SELECT permissions in the database.

Properties

Use the following guidelines when defining the properties of the SQL Server event provider.

  • ProviderName (required) must be a unique name within your application.
  • ClassName (required) must be SQLProvider.
  • Do not use the AssemblyName property. Notification Services looks in the Microsoft.SqlServer.NotificationServices.dll assembly for standard event provider information.
  • SystemName (required) usually is the name of the computer that will run this hosted event provider. For more information, see Defining Hosted Event Providers.
  • Define a timeout value (optional). The default timeout value is five minutes.
  • Define a schedule (required). For more information, see Defining Hosted Event Providers.

Arguments

The SQL Server event provider has three named arguments that are used as initialization parameters. You can specify them in any order:

  • EventsQuery (required) gathers event data as its value. The only restriction on this query is that it must return columns that map to the event fields defined for the event class. Values for all of the event fields must be returned.
    You can use either a query or a stored procedure as the value of this argument. To use a stored procedure, value is EXECstored_procedure_name.
    The SQL Server event provider runs against the local SQL Server instance. If you want to use a table on a remote server in your query, create a linked server. This allows you to use four-part names (server.database.schema.object) to access objects on the remote server. For more information, see Configuring Linked Servers for Delegation.
  • PostQuery (optional) does any processing that is required after event data is gathered. You can use either a query or a stored procedure as the value of this argument. To use a stored procedure, the value is EXECstored_procedure_name.
  • EventClassName (required) specifies the name of the event class for which this event provider submits events.

For more information about defining a hosted event provider, see Defining Hosted Event Providers.

Example: SQL Server Event Provider Definition

The following code example shows how to define a SQL Server event provider named SQLStock in an application definition file (ADF):

<Providers>
    <HostedProvider>
        <ProviderName>SQLStock</ProviderName>
        <ClassName>SQLProvider</ClassName>
        <SystemName>SLEIPNIR</SystemName>
        <Schedule>
            <Interval>P0DT00H00M60S</Interval>
        </Schedule>
        <ProviderTimeout>PT4M</ProviderTimeout>
        <Arguments>
            <Argument>
                <Name>EventsQuery</Name>
                <Value>
                SELECT StockSymbol, StockPrice
                FROM StockTable
                </Value>
            </Argument>
            <Argument>
                <Name>EventClassName</Name>
                <Value>StockEvents</Value>
            </Argument>
        </Arguments>
    </HostedProvider>
</Providers>

See Also

Concepts

Defining a SQL Server Event Provider
Gathering and Filtering Data for the SQL Server Event Provider

Other Resources

Defining Event Providers
Standard Event Providers

Help and Information

Getting SQL Server 2005 Assistance