Microsoft KB Archive/169072

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 16:34, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


BUG: Create Table with Double Precision May Be Inconsistent

Article ID: 169072

Article Last Modified on 10/16/2003



APPLIES TO

  • Microsoft SQL Server 6.0 Standard Edition
  • Microsoft SQL Server 6.5 Standard Edition



This article was previously published under Q169072

SYMPTOMS

Creating a table with double precision for the same data field column but in different order may result in an inconsistent table definition.

The following scripts demonstrate this problem:

   CREATE TABLE floatTable
   (
     GuessWhatCol double precision,
     charCol char
   )
   GO

   SP_HELP floatTable
   GO

   CREATE TABLE realTable
   (
     charCol char,
     GuessWhatCol double precision
   )
   GO

   SP_HELP realTable
   GO
                

The GuessWhatCol in floatTable becomes float, which is 8 bytes in size, while the same GuessWhatCol in realTable is real, and 4 bytes in length.

WORKAROUND

To work around this problem, you can specify the binary precision for SQL Server 6.5, or decimal precision for SQL Server 6.0. The following sample scripts demonstrate the workaround for both SQL Server 6.0 and 6.5:

 /* Using binary precision in SQL Server 6.50 */ 
   CREATE TABLE floatTable
   (
     GuessWhatCol double precision(25), /* float datatype */ 
     charCol char
   )
   GO

   SP_HELP floatTable
   GO

   CREATE TABLE realTable
   (
     charCol char,
     GuessWhatCol double precision(24) /* real datatype */ 
   )
   GO

   SP_HELP realTable
   GO

   /* Using decimal precision in SQL Server 6.0 */ 
   CREATE TABLE floatTable
   (
     GuessWhatCol double precision(8), /* float datatype */ 
     charCol char
   )
   GO

   SP_HELP floatTable
   GO

   CREATE TABLE realTable
   (
     charCol char,
     GuessWhatCol double precision(7) /* real datatype */ 
   )
   GO

   SP_HELP realTable
   GO
                

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.

Keywords: kbbug kbusage KB169072