SubscriptionConditionScheduledRule.SqlExpression Property
Gets or sets the Transact-SQL query used to generate notifications from the input and subscription data.
네임스페이스: Microsoft.SqlServer.Management.Nmo
어셈블리: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
구문
‘선언
Public Property SqlExpression As String
public string SqlExpression { get; set; }
public:
property String^ SqlExpression {
String^ get ();
void set (String^ value);
}
/** @property */
public String get_SqlExpression ()
/** @property */
public void set_SqlExpression (String value)
public function get SqlExpression () : String
public function set SqlExpression (value : String)
속성 값
A String, between 1 and 100000 characters in length, that specifies the Transact-SQL query to run each time the rule is fired.
주의
The SqlExpression property contains the core query for generating notifications, which selects subscription and input fields and adds them to the notification table.
The query must select subscription and input fields from a view that joins subscription and input data. Subscription fields in the view have names in the form [Subscription.SubscriptionFieldName]
. Input (event) fields have names in the form [Input.EventFieldName]
.
Subscribers create the equivalent of the WHERE clause for the query in their subscriptions through a subscription management interface. Notification Services evaluates the condition actions for all relevant subscriptions and then generates notifications.
For more information about condition actions, and a template for the Transact-SQL expression, see 조건 작업 정의.
예
The following examples show how to define a condition-based, scheduled subscription rule and add it to a subscription class:
// Add a rule to generate condition-based, scheduled notifications
SubscriptionConditionScheduledRule flightConditionScheduledRule =
new SubscriptionConditionScheduledRule(
flightSubscriptions, "FlightConditionScheduledRule");
flightConditionScheduledRule.ActionTimeout =
new TimeSpan(0, 2, 0);
flightConditionScheduledRule.SqlLoginName = "MyLowPrivLogin";
flightConditionScheduledRule.SqlUserName = "MyLowPrivUser";
flightConditionScheduledRule.InputTypeName = "FlightEventChronicle";
flightConditionScheduledRule.InputTypeSchema = "MyAppSchema";
flightConditionScheduledRule.SqlExpression =
"INSERT INTO MyAppSchema.FlightNotifications (SubscriberId, " +
"DeviceName, SubscriberLocale, LeavingFrom, GoingTo, Price) " +
"SELECT [Subscription.SubscriberId], " +
"[Subscription.DeviceName], [Subscription.SubscriberLocale], " +
"[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " +
"FROM MyAppSchema.FlightConditionScheduledRule;";
flightSubscriptions.SubscriptionConditionScheduledRules.Add(
flightConditionScheduledRule);
' Add a rule to generate condition-based, scheduled notifications
Dim flightConditionScheduledRule As _
SubscriptionConditionScheduledRule = _
New SubscriptionConditionScheduledRule( _
flightSubscriptions, "FlightConditionScheduledRule")
flightConditionScheduledRule.ActionTimeout = _
New TimeSpan(0, 2, 0)
flightConditionScheduledRule.SqlLoginName = "MyLowPrivLogin"
flightConditionScheduledRule.SqlUserName = "MyLowPrivUser"
flightConditionScheduledRule.InputTypeName = _
"FlightEventChronicle"
flightConditionScheduledRule.InputTypeSchema = "MyAppSchema"
flightConditionScheduledRule.SqlExpression = _
"INSERT INTO MyAppSchema.FlightNotifications " + _
"(SubscriberId, DeviceName, SubscriberLocale, LeavingFrom, " + _
"GoingTo, Price) SELECT [Subscription.SubscriberId], " + _
"[Subscription.DeviceName], [Subscription.SubscriberLocale], " + _
"[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " + _
"FROM MyAppSchema.FlightConditionScheduledRule;"
flightSubscriptions.SubscriptionConditionScheduledRules.Add( _
flightConditionScheduledRule)
스레드 보안
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.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
SubscriptionConditionScheduledRule Class
SubscriptionConditionScheduledRule Members
Microsoft.SqlServer.Management.Nmo Namespace
관련 자료
예약 규칙 정의
조건 작업 정의
ScheduledRule Element (ADF)
ConditionAction Element (ADF)