Article ID: 294860 - View products that this article applies to.
This article was previously published under Q294860
BUG #: 353206 (SHILOH_bugs)
BUG #: 352955 (SHILOH_bugs)
A query that performs a modification (an INSERT, UPDATE, or DELETE) that involves more than one (1) table, and needs Halloween Protection, may spend an excessive amount of time trying to compile a query plan. The additional time is usually not noticeable unless there are fairly large numbers of tables involved in the query.
In cases that involve multiple tables, the code to determine whether proper Halloween protection is being provided by the plan incorrectly indicates that the protection is not sufficient. Consequently, the optimizer continues its search for another query plan, and spends unnecessary time in optimization.
To 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:
(http://support.microsoft.com/kb/290211/EN-US/ )INF: How to Obtain the Latest SQL Server 2000 Service Pack
HotfixNOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 1.
The English version of this fix should have the following file attributes or later:
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.
Version File name Platform ---------------------------------- 8.00.277 s80277i.exe x86
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 1.
Halloween protection is needed to prevent a situation where the physical location of a row within a table changes due to a modification operation. As a result, the same row may be revisited multiple times within the context of a single logical operation, which should not occur. For example, this type of problem might occur if the query is modifying one of the indexed columns, and that index is being used as part of the query.
The following code is an example of a query that exhibits this problem:
NOTE: For the sake of optimization, every time dbo.S_ORG_INT is referenced in a subquery dbo.S_ORG_INT is considered a different table, so the preceding query is considering Halloween Protection for ten (10) tables (nine  references to dbo.S_ORG_INT, and one  reference to dbo.EIM_ACCOUNT).