BUG: SELECT INTO with Many UNION Clauses Returns Error 702

ID: Q171416


The information in this article applies to:

BUG #: 16990 (6.5)

SYMPTOMS

A SELECT INTO statement that takes values from many tables using the UNION operator returns error 702 when the number of UNION clauses exceeds 21.


WORKAROUND

To work around this problem, split the UNION clauses to create temporary tables and then UNION the contents of the temporary tables.


STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The following is the text of error 702:

Msg 702, Level 20, State 1
Memory request for xx bytes exceeds the size of single page of 2044
bytes. The SQL Server is terminating this process.

Against SQL Server 6.5 Service Pack 2 (build 6.50.0240), the table from the SELECT INTO is created, but it is a 'stranded' table that cannot be
dropped. If you try to drop it, the table returns the following error:
Msg 3701, Level 11, State 1,
Cannot drop the table '%s', because it doesn't exist in the system
catalogs.

A CREATE TABLE or SELECT INTO statement using the same name returns the following error:
Msg 2714, Level 16, State 1,
There is already an object named '%' in the database.

Against SQL Server 6.5 Service Pack 3 (build 6.50.0258), the same behavior occurs, but the table can be dropped normally afterwards.


Keywords          : kbusage SSrvTran_SQL kbbug6.50 
Version           : 6.5
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 19, 1999