使用货币$格式与SQL Server? [英] Using currency $ format with sql server?
问题描述
在我的sql数据库中有像 645.000
的数据,我需要格式化它以包含货币符号,例如 $ 645.000
如何在SQL中实现这个功能?
不需要,也不应该在SQL Server中进行格式化 - 相反,它是您的应用程序需要为UI进行格式化。
你没有说你的应用程序编码在,例如在C#中我们可以使用
$ b $ pre $ code Label1.Text = string.Format(Amount is {0:c},amount);
然后您就可以确定它不仅会使用正确的货币符号,还会使用正确的十进制和千位分隔符。
I have data in my sql database like 645.000
and i need to format it to include currency symbols e.g., $645.000
How can I achieve this in SQL?
You don't need to and should not be formatting it in SQL Server - instead it's your application that needs to format it for the UI.
You didn't say what your application is coded in, e.g. in C# we could use
Label1.Text = string.Format("Amount is {0:c}", amount);
Then you can be sure that not only will it use the correct currency symbol, it will also use the correct decimal and thousands separator symbols.
这篇关于使用货币$格式与SQL Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!