Article ID: 299470 - View products that this article applies to.
This article was previously published under Q299470
BUG #: 350899 (SHILOH_BUGS)
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..
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:
(http://support.microsoft.com/kb/290211/EN-US/ )INF: How to Obtain the Latest SQL Server 2000 Service Pack
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.
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.
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:
Contact us for more help
Connect with Answer Desk for expert help.