Microsoft KB Archive/246607

From BetaArchive Wiki
Knowledge Base

FIX: ODS Function Srv_describe May Fail on Certain Type Conversions

Article ID: 246607

Article Last Modified on 3/14/2006


  • Microsoft SQL Server 7.0 Standard Edition

This article was previously published under Q246607

BUG #: 55909 (SQLBUG_70)


The Open Data Services (ODS) function srv_describe must be used in an ODS application or an extended stored procedure to set the characteristics (name and data type) of a column of the result set returned to the client. The function also defines the data type of the data source. If the source and target data types differ, an implicit data conversion takes place when sending a row of the result set by calling srv_sendrow.

However, srv_describe incorrectly returns FAIL if the source data type is not a fixed length data type and the length of the source data field is greater than the maximum length of the target data type.

For example, the following call to srv_describe will return FAIL:

   srv_describe (srvproc, 1, "Col", -1, SRVINT4, 0, SRVCHAR, 5, "12345")

Whereas the following call succeeds because the source data length matches the maximum length of the target type SRVINT4, which is 4:

   srv_describe (srvproc, 1, "Col", -1, SRVINT4, 0, SRVCHAR, 4, "1234")


To work around this problem, use identical source and target data types in srv_describe and where necessary perform an explicit data conversion using srv_convert before each call to srv_sendrow.


Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0

For more information, contact your primary support provider.

Additional query words: xp xps xproc xprocs datatype datatypes

Keywords: kbbug kbfix KB246607