Sunan an-Nasa'i, Book 11, Hadith 82 (In-Book) ⓘ
It was narrated from Ibn Abbas that: The Prophet prostrated in Sad and said: "Dawud did this prostration in repentance and we do it in thanksgiving."
أَخْبَرَنِي إِبْرَاهِيمُ بْنُ الْحَسَنِ الْمِقْسَمِيُّ، قَالَ حَدَّثَنَا حَجَّاجُ بْنُ مُحَمَّدٍ، عَنْ عُمَرَ بْنِ ذَرٍّ، عَنْ أَبِيهِ، عَنْ سَعِيدِ بْنِ جُبَيْرٍ، عَنِ ابْنِ عَبَّاسٍ، أَنَّ النَّبِيَّ صلى الله عليه وسلم سَجَدَ فِي { ص } وَقَالَ " سَجَدَهَا دَاوُدُ تَوْبَةً وَنَسْجُدُهَا شُكْرًا " .
also referenced under: Hadith 957 (Reference) & Volume 2, Book 11, Hadith 958 (DarusSalam)