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.
| Author |
Topic |
|
user45
Starting Member
10 Posts |
Posted - 2011-11-22 : 04:30:55
|
| Hi I am trying to create a select statement where I want my results to contain a currency symbol (€), rounded to the nearest euro and contains commasQuery 1:SELECT '€' + CONVERT(varchar(10), CONVERT(money, SUM(Total)),1) as 'Total' FROM aResult: €46,533.05Query 2:SELECT '€' + CONVERT(varchar(10), CONVERT(decimal, SUM(Total)),1) as 'Total' FROM aResult: €46533So basically I want the result to be in the format of €46,533Is there an easy way to do this? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-11-22 : 04:32:17
|
yes. At your front end application. It is much easier to do it than in SQL Server KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
user45
Starting Member
10 Posts |
Posted - 2011-11-22 : 04:35:28
|
| If I use Query 2 above and use my front end application to do this it displays the output as €46,533.00. So I need a way to do it in SQL Server. Is it very complicated to do? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-22 : 04:42:07
|
quote: Originally posted by user45 If I use Query 2 above and use my front end application to do this it displays the output as €46,533.00. So I need a way to do it in SQL Server. Is it very complicated to do?
its really ugly to do this in sql server as it involves unnecessary casting to varchar format which will make manipulations like sorting difficult . Most front end tools have functions readily available for generating this format so thats why its always recommended to do it there and not in sql.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
user45
Starting Member
10 Posts |
Posted - 2011-11-22 : 04:47:09
|
hmmm I thought as much Thanks for your help |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-22 : 05:11:39
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|