BUG: Declare Cursor May Fail with Memory Error 702 (167609)



The information in this article applies to:

  • Microsoft SQL Server 6.5

This article was previously published under Q167609
BUG #: 16713 (Windows NT: 6.5)

SYMPTOMS

A declare cursor statement with a select list consisting of a number of coalesce statements may fail with message 702, "memory request exceeds size of a page."

WORKAROUND

To work around this problem, select into a temporary table and declare the cursor on the temporary table.

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 scenario tested in this case had 26 coalesce statements involving the aggregate function sum, as in the following:
   coalesce(sum(x),0)
				

The select list also included two more columns; however, the total length of all columns did not exceed 1,962 bytes. The where clause had four conditions anded together, and there was a group by.

When run outside of the declare cursor, the select statement ran to completion.

Testing showed that the type of cursor does not matter, nor does replacing coalesce with searched case. However, the error did not happen if one of the following was done:
  • One of the columns in the select clause was removed.
  • The group by was removed.
  • All coalesce statements were removed from all columns.
  • One condition in the where clause was sacrificed.

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbusage KB167609