FIX: Error Message 8623 Occurs If You Use INSERT-SELECT with NOT IN or NOT EXISTS Keywords in Subquery of the WHERE Clause

Article translations Article translations
Article ID: 264005 - View products that this article applies to.
This article was previously published under Q264005
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57944 (SQLBUG_70)
Expand all | Collapse all

SYMPTOMS

An attempt to INSERT INTO a column that uses a declared variable may fail if the column has the same data type as the declared variable and the WHERE clause contains a subquery that uses either a NOT EXISTS or a NOT IN keyword. In such cases, the following error message occurs:
Server: Msg 8623, Level 16, State 2, Line 8
Internal Query Processor Error: The query processor could not produce a query plan.

WORKAROUND

The following scenario causes the error message to occur:
CREATE TABLE  #example_table( c1 int NULL )
DECLARE  @variable1  int
SET @variable1 = 1
INSERT #example_table ( c1 )
SELECT @variable1 WHERE NOT EXISTS 
(SELECT * FROM #example_table)
				
To work around this problem, use the CONVERT function to change the variable to the same data type.

In the preceding example, replace
SELECT	@variable1
				
with:
SELECT CONVERT(int,@variable1)
				

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.

Properties

Article ID: 264005 - Last Review: February 28, 2014 - Revision: 5.1
APPLIES TO
  • Microsoft SQL Server 7.0 Service Pack 2
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB264005

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com