473,418 Members | 2,051 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Incorrect conversion from float to decimal.

I have two tables in SQL Server with the column name "Quantity".
Table A data type for Quantity field is float
Table B data type for Quantity field is decimal (24,11).

I have an access application that is linked to tables above.
I enter through the Access form quantity 2594334.38.
I query table A in SQL query analyzer and it is 2594334.38.
Then I ran code in access send this number into Stored Procedure in SQL Server which inserts this value into table B.
When I query table B quantity value is stored as 2594334.3399999999.

If I insert directly from Access bypassing the proc then it stores 2594334.38.
Also if I use a smaller number like 94334.38 then proc inserts the correct number.

Can I do something in SQL server proc to make this number back into 2594334.38.
Parameter for this number is declared as float.
I tried the following things but nothing helps:
1. Rounded number to 1 or 6
2. Converted to float.
3. Converted to decimal.

1.I use Access 2003 and SQL Server 2005.
Thank you
Mar 8 '10 #1
1 2394
ck9663
2,878 Expert 2GB
Can't you make the structure the same instead?

Good luck!!!

~~ CK
Mar 8 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jørgen Cederberg | last post by:
Hi, using Python 2.2.1 on Windows and QNX I'm having trouble understandig why int() raises a ValueError exception upon converting strings. >>> int('-10') -10 >>> int('10') 10 >>> int(10.1)
0
by: Suvodip Mukherjee | last post by:
Hi, I am facing a problem using the DBLIBRARY API dbconvert(). When dbconvert() is used to convert a MS SQL Server MONEY data type to DECIMAL and then to STRING, the scale is getting lost. eg....
5
by: Peter Scheurer | last post by:
Hi, we found some strange behavior when operating with floats and round(). The following simplified statement reproduces the problem. select 6.56 - round(convert(float, 6.56), 2) from...
2
by: Brian van den Broek | last post by:
Hi all, I guess it is more of a maths question than a programming one, but it involves use of the decimal module, so here goes: As a self-directed learning exercise I've been working on a...
5
by: Richard Thrasher | last post by:
Writing my very first C# program, I found what appears to be a compiler error. The statement int temp = (int)(100 * 36.41); assigns the value 3640 to temp. I've tried this code with various...
8
by: Steve Wasser | last post by:
I'm pulling SQL data into a dataset to be used to perform some math against. I asked this question earlier, but the answer someone gave me left me with further questions. The SQL data is stored as...
5
by: Pavils Jurjans | last post by:
Hello, I am somewhat lost in the implicit/expicit possible/impossible type casting in C#... I need to write a class, which among other things, must have wat to read a numeric value type, and...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
11
by: RipperT | last post by:
Don't know if this group covers web apps, but here goes. In VS 2005, I am trying to get variables to hold thier values during postback from the server. I convert a text box's user-keyed value to an...
24
by: Rajesh S R | last post by:
Isn't this code violation of C99 standard? #include <stdio.h> int main( void ) { float a = 0.7; if(a < 0.7) printf("Wrong"); else
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.