Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Openrowset problem

Status
Not open for further replies.

b00gieman

Programmer
Jul 9, 2007
60
DE
Hi!
I developed an application for importing data from an excel file to a sql table using openrowset.My problem is that some values are 'truncated' somehow.
For example,a value from the excel file like: 87987845 will appear in the sql table like: 8.79878e+007.Can somebody help me with this?

Thanks in advance!
 
Does it actually insert it like that literally, or is that perhaps just a result of the data type and display properties?

For example, if I look at database values for a float column through query analyzer and management studio, I might see something like 5.0000000000000003E-2, but when my application dumps that information to the web browser, it magically shows up on the screen as 0.05.

Why it happens in some cases and not others is still a mystery to me. For example, I might see a more friendly 1.62 immediately followed by something like 0.36399999999999999 (only in db tools - not in my application). I guess what I'm getting at is that it's not really a problem. The application that consumes this database content should be made aware of the data type and know how to handle the data regarless of how it shows up in the database.

Unless it's being stored that way in a varchar field, maybe, in which case you just need to adjust your column mapping during import.
 
I formatted all the cells in the excel files so now they are text.This seems to be working....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top