Click to See Complete Forum and Search --> : SQL 2005 field type money, need help.


leeshadmi
May 24th, 2009, 06:13 AM
Hi
I using SQL server 2005 express edition with VB.net 2008 express edition to create my application.
I have a table that contain few column and few of them are defined as money type.
I have a problem that if i save a value like 23.12 it will besaved as 23.1200 or if i save 0 it will be saved as 0.00.
Any idea how i can set it to the right number with no trailing zeros?
Thanks
Lee

:wave:

Alsvha
May 24th, 2009, 07:00 AM
The trailing zeros shouldn't be a problem as I see it, the selected value is still the same as what you entered. When ever I select from a money, I only get 2 decimals unless I've used more.
So if you select from the table, you should only get 2 decimals, regardless of what's stored in the table.

However it is how the Money datatype is stored, and the precision it has.

If you want to make sure you only have 2 decimal numbers, stored, you'll need to use the "decimal" datatype where you manually can set the precision.

leeshadmi
May 24th, 2009, 12:56 PM
Thanks i will do that.