--建立测试环境 Create Table TEST (id Int, qty Money)Insert TEST Values(1, 20054.864) Insert TEST Values(2, 4525.89) --测试 Select id,Convert(Varchar,qty,1) As qty from TEST --删除测试环境 Drop Table TEST --结果 /* id qty 1 20,054.86 2 4,525.89 */
假如Qty是Float型--建立测试环境 Create Table TEST (id Int, qty Float)Insert TEST Values(1, 20054.864) Insert TEST Values(2, 4525.89) --测试 Select id,Convert(Varchar,Cast(qty As Money),1) As qty from TEST --删除测试环境 Drop Table TEST --结果 /* id qty 1 20,054.86 2 4,525.89 */
Create Table TEST
(id Int,
qty Money)Insert TEST Values(1, 20054.864)
Insert TEST Values(2, 4525.89)
--测试
Select id,Convert(Varchar,qty,1) As qty from TEST
--删除测试环境
Drop Table TEST
--结果
/*
id qty
1 20,054.86
2 4,525.89
*/
Create Table TEST
(id Int,
qty Float)Insert TEST Values(1, 20054.864)
Insert TEST Values(2, 4525.89)
--测试
Select id,Convert(Varchar,Cast(qty As Money),1) As qty from TEST
--删除测试环境
Drop Table TEST
--结果
/*
id qty
1 20,054.86
2 4,525.89
*/