jnelson993
Posts: 794
Score: 109 Joined: 2/18/2005 From: Minneapolis, MN Status: offline
|
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]
_____________________________
Number2 (John Nelson) MyITForum - Blog MyITForum - Forum Posts
|