如何在sql中为amount列默认获取逗号 [英] How to get commas by default for amount column in sql

查看:251
本文介绍了如何在sql中为amount列默认获取逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我已经用SId,SName,Fee,Course创建了一个像StudentInfo这样的表格。现在我使用ASP.Net从前端插入了一些记录。每当试图将记录从数据库退回到前端时,我都会得到像





Hi Friends,

I have already create a table like StudentInfo with SId, SName, Fee, Course. Now I have inserted few records from front end by using ASP.Net. Whenever try to retiring the records from database to front end, I got the records like


101 Raju 15000 MCA
102 Ravi 25000 MCA
103 Ramu 30000 MCA
104 Reddy 25000 MCA
105 Sai 20000 MCA







现在我需要用逗号分隔费用详细信息,如15,000



提前付款。




Now I need to get the Fee details separated by commas like 15,000

Thanks in advance.

推荐答案

下面是解决问题的链接:



http://stackoverflow.com/que stions / 6309541 / how-do-i-convert-a-number-to-a-numeric-逗号分隔格式化字符串 [ ^ ]
Below is the link which will solve your problem:

http://stackoverflow.com/questions/6309541/how-do-i-convert-a-number-to-a-numeric-comma-separated-formatted-string[^]


您好,



查看此...



Hi,

Check this...

SELECT SId, SName,CONVERT(varchar, CAST(Fee AS money), 1) as fee, Course from StudentInfo





此外,请查看此 SQL格式函数 [ ^ ]



希望这会有所帮助你。



干杯



Also, check this SQL Format Function[^]

Hope this will help you.

Cheers


这篇关于如何在sql中为amount列默认获取逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆