2 Samuel 12:23

But now he is dead, wherefore should I fast? can I bring him back again? I shall go to him, but he shall not return to me.

The verse belongs to the history in 2 Samuel 11 and 12 in which David used the position and authority God had given him contrary to God's law to command Joab to set Uriah in the forefront of the hottest battle and withdraw from him so that he would be killed. Joab obeyed because his allegiance was to the king rather than to God, showing that it becomes sin to obey rulers when they command what breaks God's law. In that account David made Uriah the bearer of his own death-warrant, sending by his hand a letter directing Joab to put him at the front of the fiercest fighting and then retire from him that he might be smitten and die. Joab carried out the order, and Uriah fell by the sword of the children of Ammon.

Joab managed the killing with a report carefully worded not to implicate himself or the king, charging the messenger to tell the matters of the war to the king and, if the king's wrath should arise, to add that his servant Uriah the Hittite was dead also. The messenger came and showed David all that Joab had sent him for. David answered that the sword devours one as well as another, and directed Joab to make the battle stronger against the city and overthrow it. While the child was alive David fasted and grieved and pleaded for his life, but once the child died he stopped pleading and mourning and submitted to God's decree, knowing he could not bring the child back from death.

He was not left without comfort in that submission because he trusted in God's mercy. After learning of the death he rose from the floor and ended his intercession, providing an example of accepting what cannot be changed and of refusing to prolong sorrow in a way that harms the living. The reference also connects David's story with the outcome of turning from God's Word, for forsaking its teachings disgraced his reputation, and violating God's will brings retribution.