Microsoft KB Archive/246607: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 54: Line 54:
<br />
<br />
For example, the following call to '''srv_describe''' will return FAIL:
For example, the following call to '''srv_describe''' will return FAIL:
<pre class="codesample">  srv_describe (srvproc, 1, &quot;Col&quot;, -1, SRVINT4, 0, SRVCHAR, 5, &quot;12345&quot;)
<pre class="codesample">  srv_describe (srvproc, 1, "Col", -1, SRVINT4, 0, SRVCHAR, 5, "12345")
                 </pre>
                 </pre>
Whereas the following call succeeds because the source data length matches the maximum length of the target type SRVINT4, which is 4:
Whereas the following call succeeds because the source data length matches the maximum length of the target type SRVINT4, which is 4:
<pre class="codesample">  srv_describe (srvproc, 1, &quot;Col&quot;, -1, SRVINT4, 0, SRVCHAR, 4, &quot;1234&quot;)
<pre class="codesample">  srv_describe (srvproc, 1, "Col", -1, SRVINT4, 0, SRVCHAR, 4, "1234")
                 </pre>
                 </pre>



Latest revision as of 12:50, 21 July 2020

Knowledge Base


FIX: ODS Function Srv_describe May Fail on Certain Type Conversions

Article ID: 246607

Article Last Modified on 3/14/2006



APPLIES TO

  • Microsoft SQL Server 7.0 Standard Edition



This article was previously published under Q246607

BUG #: 55909 (SQLBUG_70)

SYMPTOMS

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")
                

WORKAROUND

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.

STATUS

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