Unix Technical Forum

Reading numbers from Excel

This is a discussion on Reading numbers from Excel within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> Hi, Today we discovered a problem when importing numbers from Excel (XP) into MS SQL Server 2000. e.g. when ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 07:14 PM
Alain Sienaert
 
Posts: n/a
Default Reading numbers from Excel

Hi,

Today we discovered a problem when importing numbers from Excel (XP) into MS
SQL Server 2000.

e.g. when the number 11301.80 is stored in the Excel spreadsheet then MS SQL
Server reads this as 11301.800000000001.

This value is stored in a float column and this row cannot be retrieved
using the clause "where Amount = 11301.80". I'm aware that both floats and
reals do not store exact values but when you insert this value 11301.80
using the Query Analyzer then everything is working fine. I thought that
both Excel and SQL server were using the same precision (8 bytes/15 digits).
This is an application that we didn't write ourselves and I guess I have
found the solution by changing the column type to real.

Any ideas why this goes wrong?

Thanks,
Alain Sienaert

P.S. Please note that this problems also occures when creating a linked
server to the Excel spreadsheet. When retrieving the data the Query Analyzer
displays 11301.800000000001.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com