In one narration the words are: The Prophet (peace and blessings be upon him) ordered me to kill the dogs. I went out and began killing dogs; every dog I saw, I killed. A dog was circling around a house, and as I was about to kill it, someone called out to me from inside that house: O servant of Allah, what do you intend to do? I replied: I want to kill this dog. That woman said: I am a woman left without protection; this dog keeps wild beasts away from me and alerts me (by barking) to anyone coming. Then Sayyiduna Abu Rafi' (may Allah be pleased with him) went to the Prophet (peace and blessings be upon him). After this the narrator mentioned the hadith as before.
Al-Bazzar and Ahmad recorded it with various chains, the narrators of some of which are the narrators of the Sahih. Al-Tabarani also recorded it in al-Mu'jam al-Kabir.