December 18, 2008 at 11:03 pm
hi,
my currency data loaded as following
currency
---------
1000
2223
45000
when i am querying i want to display like follows
currency
---------
1,000
2,223
45,000
what function i can use in mssql. is it possible or not?
December 19, 2008 at 6:35 am
Normally you allow the UI to handle formatting as they have formatting functions that are simple to use.
From BOL for converting money/smallmoney:
The following table shows the values for style that can be used for converting money or smallmoney to character data.
Value Output
0 (default)
No commas every three digits to the left of the decimal point, and two digits to the right of the decimal point; for example, 4235.98.
1
Commas every three digits to the left of the decimal point, and two digits to the right of the decimal point; for example, 3,510.92.
2
No commas every three digits to the left of the decimal point, and four digits to the right of the decimal point; for example, 4235.9819.
The data type has to be money/smallmoney.
I still recommend doing formatting in the UI.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply