According to 2 Samuel, who told David to have a census?

(But see 1 Chronicles 21:1 for another view.)

God

And again the anger of the LORD ... moved David against them to say, Go, number Israel and Judah. 2 Samuel 24:1