Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Decimal points in Money datatype

Author  Topic 

csecharith
Starting Member

21 Posts

Posted - 2007-10-30 : 23:39:50
Hi,

The default number of decimal points for 'money' data type is 4. Can I change it as 6?

Eg 120.123456

Thanks!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-10-30 : 23:44:16
I don't think so. use decimal() instead


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

csecharith
Starting Member

21 Posts

Posted - 2007-10-30 : 23:47:57
quote:
Originally posted by khtan

I don't think so. use decimal() instead


KH
[spoiler]Time is always against us[/spoiler]





Can I use decimal() datatype for that?
I used decimal(18,0) but it doesn't allow me to add decimal points. How can I change it to store decimal points?

Thanks!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-10-30 : 23:49:35
[code]decimal(18,6)[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-31 : 02:10:03
or use numeric(18,6)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

arorarahul.0688
Posting Yak Master

125 Posts

Posted - 2007-10-31 : 08:38:32

i dont think you can increase the length parameter of money type
column bt when u have to retrive the value of that column
in a data type of higher length you can do as

create table rr (a money)
insert into rr values(12.12345)

select * from rr
answer is 12.1235

bt when taking money as decimal we can do it
select convert(decimal(12,7),a) from rr
answer is 12.1235000

Rahul Arora
MCA 07 Batch
NCCE Israna, Panipat
HRY, INDIA
Go to Top of Page

csecharith
Starting Member

21 Posts

Posted - 2007-11-01 : 04:42:43
quote:
Originally posted by arorarahul.0688


i dont think you can increase the length parameter of money type
column bt when u have to retrive the value of that column
in a data type of higher length you can do as

create table rr (a money)
insert into rr values(12.12345)

select * from rr
answer is 12.1235

bt when taking money as decimal we can do it
select convert(decimal(12,7),a) from rr
answer is 12.1235000

Rahul Arora
MCA 07 Batch
NCCE Israna, Panipat
HRY, INDIA



Thanks A lot
Go to Top of Page

csecharith
Starting Member

21 Posts

Posted - 2007-11-01 : 04:43:31
quote:
Originally posted by khtan

decimal(18,6)



KH
[spoiler]Time is always against us[/spoiler]





Thanks A lot
Go to Top of Page
   

- Advertisement -