Wednesday, August 27, 2008 Register   Login   
   You Are Here: Discussions     
 SQL Community Portal
  
 Recently Submitted Articles
  
 Recent SQL Clinic Articles
  
 SQL Server Discussion Forums
 
  SQL Server Forums  Discussions  SQL Server DBA ...  sql 2000 problem
Disabled Previous
 
Next Next
New Post 10/15/2007 6:48 AM
Resolved
User is offline colin leversuch-roberts
6 posts
No Ranking


sql 2000 problem 

I've moved a databse from prod to dev and a calculation on a sum of a float column gives a different value. There are approx 16k rows and here are the results ( so you can see the difference )
-648365.80999999424
-648365.81000000483

The data is identical as I've checked it, assuming data compare can be trusted < grin > and the dev db is a restored backup from production.

I seem to remember something about the float datatype from way back when, which is why i don't personally use it, however this is a client database. collation etc. is the same - anyone any ideas?

 
New Post 10/16/2007 7:11 AM
User is offline Michael Hotek
5 posts
www.mssqlserver.com
No Ranking


Re: sql 2000 problem 

A float is an approximately data type.  It will not produce the same results from one processor architecture to another and won't even necessarily do so from one machine to another.  In addition, you are using a float in computations, then you will be compounding rounding factors which magnifies the effect.  If you need the calculations to a high precision as well as also requiring them to be exactly the same regardless of machine or processor architecture, then you need to replace the float data type with a decimal data type.


Michael Hotek MCT, MCITP - SQL DBA
 
New Post 10/16/2007 8:27 AM
User is offline colin leversuch-roberts
6 posts
No Ranking


Re: sql 2000 problem 

thanks so very much - that was what I thought but couldn't find anything in my searches. I needed an outside confirmation from an "authority"  and who better than yourself.

thankyou

 
Disabled Previous
 
Next Next
  SQL Server Forums  Discussions  SQL Server DBA ...  sql 2000 problem

  
   Minimize

  
SQL Server 2000 Downloads
 
SQL Server 2000 Reporting Services Downloads
 
SQL Server 2000 Notification Services SP Downloads
 
SQL Server CE Downloads
 
SQLXML 3.0 Service Pack Downloads
 
SQL Server 2000 JDBC Driver
 
MDAC 2.6 Download
 
SQL Server 2000 Tools Downloads
SQL Server 2005 & SQL Server 2000 Best Practices
·    DMV Stats
 
·    Buffer Cache
·    Input/Output
·    Performance
·    Tempdb
·    Wait Statistics
                    
SQL Server 2000 Best Practices




Cancel  Send

 Community Sharing Central
  
 Recently Submitted SQL Tips
  
 Recently Submitted Scripts
  
Subscribe to newsletter
 Subscribe to SQL Server Technical Newsletters