1 Chronicles 20-22 (ESV)
The Capture of Rabbah
20:1 In the spring of the year, the time when kings go out to battle, Joab led out the army and ravaged the country of the Ammonites and came and besieged Rabbah. But David remained at Jerusalem. And Joab struck down Rabbah and overthrew it. 2 And David took the crown of their king from his head. He found that it weighed a talent  of gold, and in it was a precious stone. And it was placed on David’s head. And he brought out the spoil of the city, a very great amount. 3 And he brought out the people who were in it and set them to labor  with saws and iron picks and axes.  And thus David did to all the cities of the Ammonites. Then David and all the people returned to Jerusalem.
Philistine Giants Killed
4 And after this there arose war with the Philistines at Gezer. Then Sibbecai the Hushathite struck down Sippai, who was one of the descendants of the giants, and the Philistines were subdued. 5 And there was again war with the Philistines, and Elhanan the son of Jair struck down Lahmi the brother of Goliath the Gittite, the shaft of whose spear was like a weaver’s beam. 6 And there was again war at Gath, where there was a man of great stature, who had six fingers on each hand and six toes on each foot, twenty-four in number, and he also was descended from the giants. 7 And when he taunted Israel, Jonathan the son of Shimea, David’s brother, struck him down. 8 These were descended from the giants in Gath, and they fell by the hand of David and by the hand of his servants.
David’s Census Brings Pestilence
21:1 Then Satan stood against Israel and incited David to number Israel. 2 So David said to Joab and the commanders of the army, “Go, number Israel, from Beersheba to Dan, and bring me a report, that I may know their number.” 3 But Joab said, “May the Lord add to his people a hundred times as many as they are! Are they not, my lord the king, all of them my lord’s servants? Why then should my lord require this? Why should it be a cause of guilt for Israel?” 4 But the king’s word prevailed against Joab. So Joab departed and went throughout all Israel and came back to Jerusalem. 5 And Joab gave the sum of the numbering of the people to David. In all Israel there were 1,100,000 men who drew the sword, and in Judah 470,000 who drew the sword. 6 But he did not include Levi and Benjamin in the numbering, for the king’s command was abhorrent to Joab.
7 But God was displeased with this thing, and he struck Israel. 8 And David said to God, “I have sinned greatly in that I have done this thing. But now, please take away the iniquity of your servant, for I have acted very foolishly.” 9 And the Lord spoke to Gad, David’s seer, saying,10 “Go and say to David, ‘Thus says the Lord, Three things I offer you; choose one of them, that I may do it to you.’” 11 So Gad came to David and said to him, “Thus says the Lord, ‘Choose what you will: 12 either three years of famine, or three months of devastation by your foes while the sword of your enemies overtakes you, or else three days of the sword of the Lord, pestilence on the land, with the angel of the Lorddestroying throughout all the territory of Israel.’ Now decide what answer I shall return to him who sent me.” 13 Then David said to Gad, “I am in great distress. Let me fall into the hand of the Lord, for his mercy is very great, but do not let me fall into the hand of man.”
14 So the Lord sent a pestilence on Israel, and 70,000 men of Israel fell. 15 And God sent the angel to Jerusalem to destroy it, but as he was about to destroy it, the Lord saw, and he relented from the calamity. And he said to the angel who was working destruction, “It is enough; now stay your hand.” And the angel of the Lord was standing by the threshing floor of Ornan the Jebusite. 16 And David lifted his eyes and saw the angel of the Lord standing between earth and heaven, and in his hand a drawn sword stretched out over Jerusalem. Then David and the elders, clothed in sackcloth, fell upon their faces. 17 And David said to God, “Was it not I who gave command to number the people? It is I who have sinned and done great evil. But these sheep, what have they done? Please let your hand, O Lord my God, be against me and against my father’s house. But do not let the plague be on your people.”
David Builds an Altar
18 Now the angel of the Lord had commanded Gad to say to David that David should go up and raise an altar to the Lord on the threshing floor of Ornan the Jebusite. 19 So David went up at Gad’s word, which he had spoken in the name of the Lord. 20 Now Ornan was threshing wheat. He turned and saw the angel, and his four sons who were with him hid themselves. 21 As David came to Ornan, Ornan looked and saw David and went out from the threshing floor and paid homage to David with his face to the ground. 22 And David said to Ornan, “Give me the site of the threshing floor that I may build on it an altar to the Lord—give it to me at its full price—that the plague may be averted from the people.” 23 Then Ornan said to David, “Take it, and let my lord the king do what seems good to him. See, I give the oxen for burnt offerings and the threshing sledges for the wood and the wheat for a grain offering; I give it all.” 24 But King David said to Ornan, “No, but I will buy them for the full price. I will not take for the Lord what is yours, nor offer burnt offerings that cost me nothing.” 25 So David paid Ornan 600 shekels  of gold by weight for the site. 26 And David built there an altar to the Lord and presented burnt offerings and peace offerings and called on the Lord, and the Lord  answered him with fire from heaven upon the altar of burnt offering. 27 Then the Lord commanded the angel, and he put his sword back into its sheath.
28 At that time, when David saw that the Lord had answered him at the threshing floor of Ornan the Jebusite, he sacrificed there. 29 For the tabernacle of the Lord, which Moses had made in the wilderness, and the altar of burnt offering were at that time in the high place at Gibeon, 30 but David could not go before it to inquire of God, for he was afraid of the sword of the angel of the Lord.
22:1 Then David said, “Here shall be the house of the Lord God and here the altar of burnt offering for Israel.”
David Prepares for Temple Building
2 David commanded to gather together the resident aliens who were in the land of Israel, and he set stonecutters to prepare dressed stones for building the house of God. 3 David also provided great quantities of iron for nails for the doors of the gates and for clamps, as well as bronze in quantities beyond weighing, 4 and cedar timbers without number, for the Sidonians and Tyrians brought great quantities of cedar to David. 5 For David said, “Solomon my son is young and inexperienced, and the house that is to be built for the Lord must be exceedingly magnificent, of fame and glory throughout all lands. I will therefore make preparation for it.” So David provided materials in great quantity before his death.
Solomon Charged to Build the Temple
6 Then he called for Solomon his son and charged him to build a house for the Lord, the God of Israel. 7 David said to Solomon, “My son, I had it in my heart to build a house to the name of the Lord my God. 8 But the word of the Lord came to me, saying, ‘You have shed much blood and have waged great wars. You shall not build a house to my name, because you have shed so much blood before me on the earth. 9 Behold, a son shall be born to you who shall be a man of rest. I will give him rest from all his surrounding enemies. For his name shall be Solomon, and I will give peace and quiet to Israel in his days. 10 He shall build a house for my name. He shall be my son, and I will be his father, and I will establish his royal throne in Israel forever.’
11 “Now, my son, the Lord be with you, so that you may succeed in building the house of the Lord your God, as he has spoken concerning you. 12 Only, may the Lord grant you discretion and understanding, that when he gives you charge over Israel you may keep the law of the Lordyour God. 13 Then you will prosper if you are careful to observe the statutes and the rules that the Lord commanded Moses for Israel. Be strong and courageous. Fear not; do not be dismayed. 14 With great pains I have provided for the house of the Lord 100,000 talents  of gold, a million talents of silver, and bronze and iron beyond weighing, for there is so much of it; timber and stone, too, I have provided. To these you must add. 15 You have an abundance of workmen: stonecutters, masons, carpenters, and all kinds of craftsmen without number, skilled in working 16 gold, silver, bronze, and iron. Arise and work! The Lord be with you!”
17 David also commanded all the leaders of Israel to help Solomon his son, saying, 18 “Is not the Lord your God with you? And has he not given you peace on every side? For he has delivered the inhabitants of the land into my hand, and the land is subdued before the Lord and his people. 19 Now set your mind and heart to seek the Lord your God. Arise and build the sanctuary of the Lord God, so that the ark of the covenant of the Lord and the holy vessels of God may be brought into a house built for the name of the Lord.”