all groups > sql server new users > february 2007 >
You're in the

sql server new users

group:

how to prevent type 'money' round values?



how to prevent type 'money' round values? michel
2/20/2007 12:00:00 AM
sql server new users: Hi,

i defined a field as 'money' (and then as 'smallmoney').
When i insert a non integer value in that field, it's rounded: e.g. if i
insert 17,95, it becomes 18,0000 in the table.
Any way to prevent That?

thanks
michel

Re: how to prevent type 'money' round values? Rick Byham, (MSFT)
2/21/2007 1:30:09 PM
That shouldn't be happening. I'm using the US period separator but I see
this:
CREATE TABLE T1
(ColMoney money,
ColSmallMoney smallmoney)
GO
INSERT T1(ColMoney, ColSmallMoney)
VALUES (17.9567, 17.9567)
GO
SELECT * FROM T1
GO

Result set:
ColMoney ColSmallMoney
--------------------- ---------------------
17.9567 17.9567

(1 row(s) affected)

How are you entering the data? Perhaps it is being converted to an int
before the insert.
--
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]
AddThis Social Bookmark Button