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 2008 Forums
 Transact-SQL (2008)
 convert double to money with a sign.

Author  Topic 

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2013-03-28 : 22:51:59
I am trying to convert this decimal(10,2) that brings 1233,00
to $ 1233,00 (or any other money sign).
If i do this :
moneytbl.moneysign + ' ' + (CONVERT(nvarchar(50),convert(money,operations.amount))) as price

I get $ 1233.00 so instead of a comma i get a dot.
Any help?
Thanks.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-29 : 00:36:53
replace dot(.) with comma(,)
--example
DECLARE @numtest as DECIMAL(10,3)
SET @numtest = 123.456
SELECT @numtest -- decimal with dot
SELECT REPLACE(CONVERT(VARCHAR(13), @numtest), '.', ',') -- String with comma
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2013-03-29 : 19:58:25
Thanks.
Go to Top of Page
   

- Advertisement -