Microsoft KB Archive/299470

= FIX: SELECT with Distinct and Self Loop Join May Cause 1203 Error Message =

Article ID: 299470

Article Last Modified on 11/5/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q299470



BUG #: 350899 (SHILOH_BUGS)



SYMPTOMS
A SELECT query that uses the DISTINCT function, which includes a self table join (joining a table to itself) by using nested loops, may fail with the following error message:

Error: 1203, Severity: 20, State: 1

Process ID 51 attempting to unlock unowned resource PAG: 8:1:797..



RESOLUTION
To resolve this problem, obtain the latest service pack for 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



WORKAROUND
Force a different join type for the self-join such as a hash or merge join. In some cases, the problem may not occur if the table is reorganized by rebuilding an existing clustered index or adding a clustered index.



STATUS
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.



MORE INFORMATION
Analyze the estimated execution plan for the query by using Query Analyzer or the SET SHOWPLAN statement to determine if the self-join operation is using a nested loop join.

The following is an example of a query that may encounter this problem: SELECT distinct tblusers1.firstname FROM tblUsers JOIN tblUsers tblUsers1 ON tblUsers.ReportsToID = tblUsers1.UserID WHERE (tblUsers.PracticeID = 8)

Keywords: kbbug kbfix kbsqlserv2000sp1fix KB299470

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.