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 |
|
MacJK
Starting Member
24 Posts |
Posted - 2009-12-16 : 17:29:24
|
| Hello, I need to show multiple currency in one Colum (ShowPrice) how I can format each correct?PK Name Price(money) Currency ShowPrice1 ABC 1500,0000 EUR €1.500,00 2 CFE 2400,0000 USD $1,500.003 CVF 200,0000 USD $200.004 XDE 800,0000 EUR €800,00is there a function or convert style i can use in the SELECT?for USD i use this but what for other currencys?, '$'+CONVERT(VARCHAR, '200',1) AS ShowPriceMany thanks for help and hints!brJaroslaw |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-16 : 18:10:29
|
| There is no function in SQL for that. You could do something likeCASE Currency WHEN 'EUR' THEN '€' WHEN 'USD' THEN '$'END + convert(varchar(10),showprice)JimEveryday I learn something that somebody else already knew |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-12-16 : 18:49:05
|
But in a few hours Madhivanan is gonna reply that you should be doing these kind of formatting in your front end |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-12-16 : 20:59:03
|
I may be wrong but I don't think front end will be able to do that.create a table to store the currency code and the corresponding currency sign. Or if you have a currency table, add the sign column to it.inner join to the currency table and return the sign as a column and let the front end perform the required formatting. Concatenate it in SQL will means you are returning the ShowPrice to your application as a string and you will not be able to perform any sorting with that KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-17 : 02:16:21
|
quote: Originally posted by vijayisonly But in a few hours Madhivanan is gonna reply that you should be doing these kind of formatting in your front end 
Yes it is MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|