FunctionValue Class

Represents an Argument object that obtains its value from a Transact-SQL user-defined function.

Espace de noms: Microsoft.SqlServer.NotificationServices.Rules
Assembly: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)

Syntaxe

'Déclaration
Public Class FunctionValue
    Inherits Argument
public class FunctionValue : Argument
public ref class FunctionValue : public Argument
public class FunctionValue extends Argument
public class FunctionValue extends Argument

Notes

Use the FunctionValue class to use custom database logic to determine an argument value. Your user-defined function must have a scalar return type.

You must specify the user-defined function and parameters in the FunctionValue constructor or using the Parameters and Name properties.

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.NotificationServices.Rules.RuleObject
     Microsoft.SqlServer.NotificationServices.Rules.Argument
      Microsoft.SqlServer.NotificationServices.Rules.FunctionValue

Exemple

The following example shows the definition of a user-defined function, and then uses this function to evaluate events:

// Subscription based on the following function definition:

/*
create function SoundexMatch(@x nvarchar(max), @y nvarchar(max))
returns bit
as
begin
    if soundex(@x) = soundex(@y)
        return 1

    return 0
end
 * */

// Create subscription and define basic properties.
s = new Subscription(nsApplication, subscriptionClassName);
s.SubscriberId = "Richard";
s.Enabled = true;
s.RuleName = "InventoryTrackerRule";
s.SetFieldValue("DeviceName", "myDevice");
s.SetFieldValue("SubscriberLocale", "en-us");

// Define a condition that uses the function to evaluate
// if the condition is true.
s.Condition = new BooleanLeafCondition(new FunctionValue(
    db.UserDefinedFunctions["SoundexMatch", "dbo"],
    new FieldValue("ProductName"),
    "Rood-250 Black, 48"));

// Add subscription.
s.Add();

Sécurité des threads

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

FunctionValue Members
Microsoft.SqlServer.NotificationServices.Rules Namespace

Autres ressources

Utilisation de procédures stockées (MDX)