Click here to Skip to main content
15,868,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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


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



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

Thanks in advance.
Posted
Updated 12-Sep-14 1:31am
v2

 
Share this answer
 
Hi,

Check this...

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


Also, check this SQL Format Function[^]

Hope this will help you.

Cheers
 
Share this answer
 
v2
Comments
Member 10021658 12-Sep-14 7:54am    
Msg 207, Level 16, State 1, Line 1
Invalid column name 'amount_cal'.

I have create the price column datatype si int.
Magic Wonder 12-Sep-14 7:55am    
Replace it with fee i.e. actual col in your table. I have already edited my solution.
Member 10021658 12-Sep-14 8:17am    
But how to set before creating a table?
Magic Wonder 12-Sep-14 8:52am    
Why do you want to store it in that format? Format it while fetching and displaying it in front end.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900