PRB: A SELECT INTO Query May Return the Internal Query Processor Error 8630 (323586)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)
  • Microsoft SQL Server 7.0

This article was previously published under Q323586

SYMPTOMS

A SELECT INTO query may return the following error message
Msg 8630, Level 16, State 77, Line XX Internal Query Processor Error: The query processor encountered an unexpected error during execution.
when all of the following conditions are true:
  • You run the same SELECT INTO query twice and separately.
  • In between the two executions, you perform an operation that causes SQL Server to recompile the second SELECT INTO query.

WORKAROUND

To work around this problem, add the option KEEP PLAN after the second SELECT INTO statement, or change the current database to the target database before you run SELECT INTO statements.

For example, you can add the KEEP PLAN option, or specify the target database before you run the SELECT INTO statement:

Example:

Instead of using the following:
select * into test2..t2 from test1..t1
				
Change it to either of the following:

select * into test2..t2 from test1..t1 option (keep plan)
					
-or-
use test2
go
select * into test2..t2 from test1..t1
					


Modification Type:MajorLast Reviewed:10/16/2003
Keywords:kbpending kbprb KB323586