December 20, 2011 at 3:51 am
Hi all,
Need assistance in building sql server query to format numbers as dont want to handle this formatting in front end.
required format as under:
format-number(@ScheduledCapacity,'###,##0')
appreciate your help.
December 20, 2011 at 4:00 am
This kind of formatting should be done in the front end. SQL doesn't have a lot of string formating functions (which front end apps tend to do) and presentation should be done in the presentation layer.
To do what you want will need probably a couple of CAST, maybe round (or ceiling or floor) and, by the looks of things, some string concatenation as well.
What should the following display as?
12
0.2658441
5215456.12345
2.3
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 20, 2011 at 5:42 am
I have limitation not to handle it in front end.
It should be like:
123,456,78
December 20, 2011 at 8:43 am
I gave 4 pieces of sample data. How should those 4 be formatted?
Why the limitation? the front end is the correct place to do this, doing it in SQL is going to be a pain.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply