FIX: Update With Self Join May Update Incorrect Number Of Rows (285870)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
- Microsoft SQL Server 7.0
This article was previously published under Q285870
BUG #: 101111 (SQLBUG_70)
BUG #: 351761 (SHILOH_bugs)
SYMPTOMS
An UPDATE operation may not modify the correct number of rows if the following conditions are met:
- Your query updates a column, ColA, from a table TabA.
- The query references TabA again, using an alias TabB.
- There is a reference to TabB.ColA somewhere in the query.
- None of the columns being updated in TabA are indexed columns.
- A hash or merge join is used.
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 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 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 Alpha
NOTE: 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:
- Force a loop join by using OPTION(LOOP JOIN).
-or-
- Add an index on the updated columns.
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.
Modification Type: | Major | Last Reviewed: | 10/28/2003 |
---|
Keywords: | kbBug kbfix KB285870 |
---|
|