SQL Server 2008的千位分隔符 [英] SQL Server 2008 thousands separator for a column
本文介绍了SQL Server 2008的千位分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为 TotalArea
的列,其格式为 numeric(12,2)
。
I have a column called TotalArea
and its format is numeric (12,2)
.
我希望它显示具有一千个分隔符的数字,所以当我
I want it to display the numbers with a thousand separator so when I
select TotalArea from table
的TotalArea以显示我的格式为 1,234.00
。
to show me a format like 1,234.00
.
我该怎么办?谢谢!
推荐答案
尝试这种方式:
select replace(convert(varchar,convert(Money, TotalArea),1),'.00','')
from table
或
SELECT CAST(CONVERT(varchar, CAST(123456 AS Money), 1) AS varchar)
from table
这篇关于SQL Server 2008的千位分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文