MSSQL 2014: 唯一資料表的計算失敗

Microsoft.SQLServer.2014.Unique_table_computation_failed_1_5_Rule (Rule)

資料庫用戶端驅動程式 (如 SQL Server 的 Microsoft Access 驅動程式) 會使用唯一資料表以建立可更新的查詢。如為指定的 SELECT 陳述式,唯一資料表會指出資料列之值在結果集中最多出現一次的資料表。從結果集中重新選取資料列時,從唯一資料表的主要資料行取得之值便足以識別資料列。當伺服器無法計算唯一資料表時會發生此錯誤。

Knowledge Base article:

摘要

資料庫用戶端驅動程式 (如 SQL Server 的 Microsoft Access 驅動程式) 會使用唯一資料表以建立可更新的查詢。如為指定的 SELECT 陳述式,唯一資料表會指出資料列之值在結果集中最多出現一次的資料表。從結果集中重新選取資料列時,從唯一資料表的主要資料行取得之值便足以識別資料列。當伺服器無法計算唯一資料表時會發生此錯誤。

原因

當 SELECT 查詢具有 UNION、GROUP BY、ROLL UP 或其他彙總時可能會發生此錯誤。唯一資料表未針對這些情況做定義。

解決方式

重新撰寫查詢,以免除妨礙唯一資料表計算的結構。在大多數的錯誤案例中並不能實作可更新的結果集。

可覆寫的參數

名稱

描述

預設值

已啟用

啟用或停用該工作流程。

優先順序

定義警示優先順序。

1

嚴重性

定義警示嚴重性。

2

Element properties:

TargetMicrosoft.SQLServer.2014.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID16959
Event Source$Target/Property[Type="SQL2014Core!Microsoft.SQLServer.2014.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL 2014: 唯一資料表的計算失敗
{0}
Event LogApplication
CommentMom2014ID='{E8827C4D-1683-4BC1-915A-32FB2D21441B}';MOM2014GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.Windows.EventProvider Default
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.2014.Unique_table_computation_failed_1_5_Rule" Target="SQL2014Core!Microsoft.SQLServer.2014.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2014ID='{E8827C4D-1683-4BC1-915A-32FB2D21441B}';MOM2014GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Windows!Microsoft.Windows.EventProvider">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SQL2014Core!Microsoft.SQLServer.2014.DBEngine"]/ServiceName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>16959</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>2</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2014.Unique_table_computation_failed_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>Event ID: $Data/EventDisplayNumber$. $Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>