Problem: According to this verse, David was without sin except on one occasion—the sin involving Bathsheba! It claims David “had not turned aside from anything that He [God] commanded him all the days of his life, except in the matter of Uriah the Hittite.” But, this is both contrary to general statements about fallen human beings (cf. Gen. 6:5; Jer. 17:9; Rom. 3:10–23) and specific condemnations of David on other occasions. David himself said, after God convicted him for numbering Israel (1 Chron. 21:1), “I have sinned greatly” (v. 8).
Solution: The statement in question is by no means a pronouncement of David’s virtual sinlessness for several reasons. First of all, it is a general and true characterization of David’s life. Just as Job was not sinless, but was called “blameless and upright” (Job 1:1), even so David’s life was without major fault. Second, this commendation of David is not absolute, but relative to all the sins Abijam had committed (cf. 1 Kings 15:1, 3). David did, with one major exception, “that which was right in the eyes of the Lord” (v. 5). Third, even when he sinned, he did what was right, namely repented immediately when confronted by God (cf. 2 Sam. 12:1ff and 1 Chron. 21:8). Fourth, the exception clause (“except in the matter of Uriah the Hittite”) is not found in many manuscripts of the OT, including the Vatican Ms. Without it, the point that this was only a general commendation of David has even stronger force. Fifth, the phrase “had not turned aside” indicates that God is speaking of the generally steadfast direction of David’s life, not every specific sin in it. This would account for why David’s other sins are not mentioned, since they did not turn him from the generally forward direction of his life in serving the Lord to this point.