Using currency $ format with sql server?

前端 未结 4 1566
面向向阳花
面向向阳花 2021-01-29 06:13

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?

4条回答
  •  迷失自我
    2021-01-29 06:38

    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.

提交回复
热议问题