BUG: AV on Cursor with Arithmetic Operation and ORDER BY ClauseLast reviewed: November 19, 1997Article ID: Q177007 |
The information in this article applies to:
SYMPTOMSSQL Server generates an access violation (AV) when declaring a dynamic cursor that contains an arithmetic operation on a column that is contained in an ORDER BY clause. The AV does not occur if the arithmetic operation is performed on the first column in the ORDER BY clause. However, performing the arithmetic operation on any other column position in the ORDER BY clause does cause the AV.
WORKAROUNDTo work around this problem, do either of the following:
STATUSMicrosoft has confirmed this to be a problem in 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 INFORMATIONThe following script will reproduce the access violation:
CREATE TABLE dbo.ftt ( ftt_date datetime NULL , ftt_amount smallmoney NULL , ftt_vat smallmoney NULL , ftt_int int ) GO declare test cursor for select (ftt_amount+ftt_vat) from ftt order by ftt_date, (ftt_amount+ftt_vat), ftt_int open test close test deallocate test go drop table ftt goIf the ORDER BY clause is changed so that the arithmetic operation is the first column in the ORDER BY, the access violation does not occur. The following is an example of this change for the problem scenario described above:
order by (ftt_amount+ftt_vat), ftt_date, ftt_int |
Additional query words: DB-Library Process Dead Connection Broken
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |