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
 return value with $ sign

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2012-07-25 : 09:16:35
Hi All.

I have table in SQL Server 2008 with field smallmoney and would like to return value of that field with $ sign. Is that possible? If yes what need to do?

Thanks.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-07-25 : 09:25:29
You better should do the formatting in your front end.
If that isn't possible then here is an example on how to concatenate what you want:

declare @test smallmoney
set @test=10500.77

select convert(varchar(255),@test) + ' $'



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-25 : 10:19:58
where do you want to display the values? most front end application have currency formatting functions which you can use for this

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

eugz
Posting Yak Master

210 Posts

Posted - 2012-07-25 : 11:11:39
I created stored procedure based on this table and fill ListView for that I need to display value with $ sign and not only numeric value.
Based on first replay, thanks webfred, I modified like '$ '+Convert(varchar(255), Amount) to display $ sign before amount value.

Thanks.
Go to Top of Page
   

- Advertisement -