Article ID: 308756
Article Last Modified on 10/16/2003
APPLIES TO
- Microsoft SQL Server 2000 Standard Edition
This article was previously published under Q308756
BUG #: 354940 (SHILOH_BUGS)
SYMPTOMS
SQL Server infinitely recompiles a batch when the batch uses different user-defined data types from two different databases.
The following example demonstrates the problem:
USE pubs GO EXEC sp_addtype 'type1', 'nvarchar(100)' GO USE northwind GO EXEC sp_addtype 'type2', 'nvarchar(100)' GO USE pubs GO USE pubs DECLARE @p type1 USE northwind DECLARE @p2 type2 GO
You will see the endless recompile for the last batch in the preceding sample.
WARNING: You may not want to test this script on a production server because the recompilation may introduce some overhead on the production system. You need to manually cancel the query or use the KILL command to terminate the system process ID (SPID) that is running the query to stop the recompilation.
RESOLUTION
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:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
WORKAROUND
To work around this problem, add the user-defined data types in one database. Do not use user-defined data types from two or more databases in a single batch.
STATUS
Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.
Keywords: kbbug kbfix KB308756