BUG: STR() Inconsistent with Exact Numeric Data

ID: Q154000


The information in this article applies to:


SYMPTOMS

The STR() function does not consistently truncate or round exact numeric data.


STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server versions 6.0 and 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The problem is illustrated in the following scenario, where the STR() function truncates for the first case, and rounds for the second:


   declare @x1 numeric(8,6), @x2 numeric(8,6)
   select @x1 = 12.104375, @x2 = 12.128175

   select str(@x1, 9, 5) STR, round(@x1, 5) ROUND
   select str(@x2, 9, 5) STR, round(@x2, 5) ROUND 


Keywords          : kbbug6.50 kbbug6.00 
Version           : 6.0 6.5
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 1, 1999