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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Make money field only display 2 decimal

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-08-10 : 16:24:00
Money field display like 59.6600.
How to make 59.66?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-08-10 : 17:31:22
Ashley's recommendation: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=87689
quote:
Originally posted by ashley.sql

CREATE TABLE #Table1 (C1 money)

INSERT INTO #Table1 VALUES(4.13)
INSERT INTO #Table1 VALUES(4.24)
INSERT INTO #Table1 VALUES(6.76)
INSERT INTO #Table1 VALUES(5.17)
INSERT INTO #Table1 VALUES(5.29)

select convert(varchar(20),C1) from #table1





Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-08-10 : 17:34:49
But my recommendation would be:

declare @d decimal (10,5)
set @d = 59.6600
select @d, convert(Decimal(10,2) , @d)

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -