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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 convert double to money with a sign.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sapator
Constraint Violating Yak Guru

Greece
462 Posts

Posted - 03/28/2013 :  22:51:59  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2242 Posts

Posted - 03/29/2013 :  00:36:53  Show Profile  Reply with Quote
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

Edited by - bandi on 03/29/2013 00:41:55
Go to Top of Page

sapator
Constraint Violating Yak Guru

Greece
462 Posts

Posted - 03/29/2013 :  19:58:25  Show Profile  Reply with Quote
Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000