FIX: The setting for the precision and the scale of the data that is returned from a stored procedure output parameter is (38,0) when a null value is returned in SQL Server 2000 (892406)
The information in this article applies to:
- Microsoft SQL Server 2000 Developer Edition
- Microsoft SQL Server 2000 Standard Edition
- Microsoft SQL Server 2000 Enterprise Edition
- Microsoft SQL Server 2000 Personal Edition
- Microsoft SQL Server 2000 Enterprise Evaluation Edition
- Microsoft SQL Server 2000 Workgroup Edition
- Microsoft SQL Server 2000 Desktop Engine (MSDE)
- Microsoft SQL Server 2000 Developer Edition 64 bit
- Microsoft SQL Server 2000 Enterprise Edition 64-bit
Bug #: 473209 (SQL Server 8.0) SYMPTOMSAssume the following scenario: In Microsoft SQL Server 2000, a stored procedure output parameter uses a decimal data type or a numeric data type. When a null value is returned, the setting for the precision and the scale of the data that is returned from the stored procedure output parameter is (38,0). This setting is retained on subsequent calls to the stored procedure. This behavior may cause data to be rounded to an integer value. This problem applies only to applications that use the System.Data.SqlClient namespace. This problem does not affect applications that use other data access APIs. For example, you have a stored procedure that has a DECIMAL(19,4) output parameter. Then, you call the following stored procedure from a parameterized SqlCommand.ExecuteNonQuery method. CREATE PROCEDURE ParameterPrecisionTest(
@pIn DECIMAL(19,4),
@pOut DECIMAL(19,4) OUTPUT)
AS
SET @pOut = @pIn When you do this, you experience the following symptoms: - When you call the ExecuteNonQuery method and set the SqlParameter output parameter to 1.5, 1.5 is returned.
- When you call the ExecuteNonQuery method and set the SqlParameter output parameter to DBNull, System.DBNull is returned.
- When you call the ExecuteNonQuery method and set the SqlParameter output parameter to 1.5, 2 is returned.
Note In the second call to the stored procedure, the precision and the scale are reset to (38,0). A value of 2 is returned in the third call to the stored procedure. CAUSEThis problem occurs because SQL Server resets the precision and the scale to (38,0) when the following conditions are true: - You call a stored procedure that contains a SqlParameter output parameter.
- You set the parameter to DBNull.
RESOLUTIONService pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 How to obtain the latest SQL Server 2000 service pack
STATUS This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.
Modification Type: | Major | Last Reviewed: | 4/13/2005 |
---|
Keywords: | kbBug kbtshoot kbprb kbfix KB892406 kbAudDeveloper |
---|
|