|
jnelson993 -> RE: How to get Decimal place (7/16/2008 5:16:57 PM)
|
Oh, if you're doing multiplication/division on all integers, it will do integer math. If you include a floating point number, it will do floating point math. So, just put 100.0 in there and it will treat the whole thing as a floating point operation SELECT SnapshotDate, SiteID, PatchID, TotalInstalled, TotalMissing, (TotalInstalled + TotalMissing) AS Total, CAST((100.0 * TotalInstalled / CASE WHEN (TotalInstalled + TotalMissing) = 0 THEN 1 ELSE (TotalInstalled + TotalMissing) END) AS DECIMAL(5,2)) AS [% Compliant]
|
|
|
|