FIX: Update With Self Join May Update Incorrect Number Of Rows
This article was previously published under Q285870
BUG #: 101111 (SQLBUG_70) BUG #: 351761 (SHILOH_bugs) On This PageSYMPTOMS
An UPDATE operation may not modify the correct number of rows if the following conditions are met:
CAUSE
The query plan may not include a necessary Table Spool below the UPDATE operator, which is necessary to provide Halloween Protection.
RESOLUTIONSQL Server 2000To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:290211 (http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack
SQL Server 7.0To resolve this problem, obtain the latest service pack for Microsoft SQL Server 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:301511 (http://support.microsoft.com/kb/301511/EN-US/) INF: How to Obtain the Latest SQL Server 7.0 Service Pack
NOTE: The following hotfix was created prior to Microsoft SQL Server 7.0 Service Pack 4. The English version of this fix should have the following file attributes or later: Version File name Platform ------------------------------------- 7.00.978 s70978i.exe x86 7.00.978 s70978a.exe AlphaNOTE: Because of file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files. WORKAROUND
To work around this problem:
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. SQL Server 2000 This problem was first corrected in SQL Server 2000 Service Pack 1. SQL Server 7.0 This problem was first corrected in Microsoft SQL Server 7.0 Service Pack 4. MORE INFORMATION
Halloween protection is needed to prevent a situation where the physical location of a row within a table changes due to an UPDATE operation. As a result, the same row may be revisited multiple times within the context of a single logical operation, which should not occur. If the conditions for this particular bug are met, the SQL Server optimizer may not build a plan with appropriate Halloween protection. The following example demonstrates the problem:
Here are the correct contents of the table after the update: -- CORRECT results: id pid rn fn ----------- ----------- -------- ---- 0 NULL root root 1 0 1 root/1Here are the results you obtain prior to applying the fix: -- INCORRECT results: id pid rn fn ----------- ----------- -------- ---- 0 NULL root root 1 0 1 root/1 2 1 2 root/1/2 3 2 3 root/1/2/3 4 3 4 root/1/2/3/4 5 4 5 root/1/2/3/4/5 6 5 6 root/1/2/3/4/5/6 7 6 7 root/1/2/3/4/5/6/7 8 7 8 root/1/2/3/4/5/6/7/8 9 8 9 root/1/2/3/4/5/6/7/8/9
| Article Translations
|
Back to the top
