August 22, 2005 at 9:14 am
Is there a sql function to format data..for example 13965.00 to 13,965.00
Thanks!
August 22, 2005 at 9:40 am
I do not believe there is.
But in general I do not format data out of the database.
Formatting should be the job of the presentation layer.
If you were to format the value this way 13,965 you would have to cast it into a character data type. Which if you then have to perform calculations on this value in the presentation layer, then it would have to be cast back into a number datatype, this adds too much work on both the db, and application.
August 22, 2005 at 9:44 am
I guess I should rephrase my question...
The data is stored in the table as 13965.00...I just want to present it as 13,965.00.
August 22, 2005 at 9:46 am
Still the job of the application to transform the data for presentation... the db should only store and ship the data, nothing more.
August 22, 2005 at 9:54 am
It is a presentation issue. But here a thread that might help.
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=169&messageid=182077
I wasn't born stupid - I had to study.
August 22, 2005 at 11:35 am
If you have to do it via TSQL, look up CONVERT in the BOL. You will have to CONVERT to money and then to VARCHAR.
CONVERT(VARCHAR(20), (CONVERT(MONEY, 13965.00)), 1)
-SQLBill
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply