FIX: Update Plan with User Defined Function May Fail to Find a Plan (294787)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q294787
BUG #: 352705 (SHILOH_BUGS)

SYMPTOMS

In some situations when you run either an INSERT, UPDATE, or DELETE statement with a SELECT statement that use a user defined function (UDF), the following error message may occur:
Server: Msg 8623, Level 16, State 1, Line 1
Internal Query Processor Error: The query processor could not produce a query plan. Contact your primary support provider for more information.

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

Alter the non-clustered primary key constraint to be a clustered primary key constraint.

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

To reproduce the error message, use this code:
INSERT test
(CaseId               
,SubCaseId            
,CaseIdleTime             
)
SELECT
sc.caseid AS CaseId,
sc.subcaseid AS SubCaseId,
convert(real,
    datediff(mi,
        dbo.udfGMTConvert(sc.SubCaseNonNotesLaborLogTime,s.GMTOffset),
        e.WarehouseEffectiveThroughTimeGMT 
    ) )
FROM 	dbo.vwcase c
JOIN 	dbo.vwsubcase sc
ON 	c.caseid = sc.caseid
JOIN    dbo.vwSource s on s.SourceId = c.SourceId
JOIN    dbo.vwWarehouseEffectiveThrough e on e.SourceId = c.SourceId
<BR/>
The constraint for the test table:<BR/>
ALTER TABLE [dbo].[test] WITH NOCHECK ADD 
	CONSTRAINT [PK_test_Fact] PRIMARY KEY NONCLUSTERED 
	(
		[CaseId],
		[SubCaseId]
	)  ON [PRIMARY] 
GO
				

Modification Type:MajorLast Reviewed:11/6/2003
Keywords:kbBug kbCodeSnippet kbfix kbSQLServ2000sp1fix KB294787