BUG: SQLDescribeCol Returns Wrong Column Size in a Complex Union Query with Parameters (308264)
The information in this article applies to:
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.5 SP1
- Microsoft Data Access Components 2.5 SP2
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.6 SP1
- Microsoft Data Access Components 2.6 SP2
- Microsoft Data Access Components 2.7
- Microsoft ODBC Driver for SQL Server 2000 2000.80.194
- Microsoft ODBC Driver for SQL Server 2000 2000.80.380
- Microsoft ODBC Driver for SQL Server 2000 2000.81.7713.0
- Microsoft ODBC Driver for SQL Server 3.7
This article was previously published under Q308264 SYMPTOMSSQLDescribeCol returns an incorrect column size for a complex union query that contains parameters and a WHERE clause.
CAUSE
The driver truncates the query for the meta data on the UNION keyword. As a result, only meta data for the first query is requested from Microsoft SQL Server. The second query is ignored. If you change the order of the queries, SQLDescribeCol returns correct data.
RESOLUTION
To work around this problem, do either of the following:
- Compile the query into a stored procedure that uses parameters.
- Reverse the order of the SELECT statements in the union query so that the constant field is in the last SELECT statement.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbbug kbnofix KB308264 |
---|
|