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 |
|
werhardt
Constraint Violating Yak Guru
270 Posts |
Posted - 2008-10-23 : 10:24:37
|
| I need to calculate a percent for this.CAST(sum(clm_sppo) / sum(clm_tchg) * 100 AS decimal(4, 2)) AS PercentSavings.The number that is coming out of this statement is 20.03. It needs to be 20.08. How can I change this? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-23 : 10:26:42
|
| what are datatypes of clm_sppo & clm_tchg? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-23 : 10:26:59
|
CAST(100.0 * sum(clm_sppo) / sum(clm_tchg) AS decimal(4, 2)) AS PercentSavings E 12°55'05.63"N 56°04'39.26" |
 |
|
|
werhardt
Constraint Violating Yak Guru
270 Posts |
Posted - 2008-10-23 : 10:58:20
|
They are varcharquote: Originally posted by visakh16 what are datatypes of clm_sppo & clm_tchg?
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-23 : 11:15:44
|
CAST(sum(cast(clm_sppo as money)) / sum(cast(clm_tchg as money)) AS decimal(4, 2)) AS PercentSavings E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|