Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2013-06-19 : 15:39:20
|
current field salesgm.gp shows the current results.gp.045364.574345I want it to show 2 decimal places45.2657.43 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2013-06-19 : 15:50:27
|
SELECT ROUND(gp*100.0,2) gp_pct FROM salesgm |
|
|
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2013-06-19 : 15:57:05
|
thought the same thing, but get this. The rounding is good but I need to drop those other 4 0's.ROUND(HB_JL_salesgm.GP * 100.0, 2)34.75000041.320000 |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-06-19 : 17:23:15
|
Cast it to decimal(nn,2), for example:SELECT CAST(ROUND(gp*100.0,2) AS DECIMAL(19,2)) gp_pct FROM salesgm And, you do know someone will reply to this thread suggesting that you do this kind of formatting in the presentation layer, don't you? |
|
|
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2013-06-20 : 07:43:59
|
That is actually what I ended up doing. :) |
|
|
hbadministrator
Posting Yak Master
120 Posts |
Posted - 2013-06-20 : 07:44:44
|
I was trying to get it all formatted in the back end but then said screw this I'll do it in the front end. |
|
|
|
|
|