BUG: Dbcursoropen() Causes Access Violation When Selecting More than 254 Columns (244498)
The information in this article applies to:
- Microsoft SQL Server 6.5
- Microsoft SQL Server 7.0
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q244498
BUG #: 56549 (SQLBUG_70)
BUG #: 18907 (SQLBUG_65)
SYMPTOMS
A DB-Library application generates an access violation (AV) when opening a server-side cursor by means of the dbcursoropen function on a Transact-SQL statement that returns more than 254 columns. The text of the error message is:
The instruction at "0x733299ce" referenced memory at "0x00080130". The memory could not be "written".
CAUSE
Due to a limitation in the Tabular Data Stream (TDS) 4.2 specification, a maximum of 254 columns are allowed in a cursor. However, neither DB-Library nor SQL Server check to see when this limit has been exceeded.
WORKAROUND
If more than 254 columns are being returned because the query is of the form "SELECT * FROM table", restrict the number of columns by specifying only those columns that are required in the application (for example, use a statement like "SELECT col1, col2 FROM table").
If you must open a server-side cursor on 255 or more columns, you must upgrade the application to use an API that can take advantage of the newer TDS 7.0 specification, which does not have this limitation. DB-Library will not be enhanced to support TDS 7.0 features, but the SQL Server ODBC driver and OLE-DB provider that are included with MDAC 2.1 or later support TDS 7.0.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. MORE INFORMATION
A TDS 7.0 ODBC driver will have a version of 3.70.623 or later.
Modification Type: | Major | Last Reviewed: | 11/17/2003 |
---|
Keywords: | kbBug kbpending KB244498 |
---|
|