Mishkat al-Masabih 250
وَعَنْهُ مُرْسَلًا قَالَ: سُئِلَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ عَنْ رَجُلَيْنِ كَانَا فِي بَنِي إِسْرَائِيلَ أَحَدُهُمَا كَانَ عَالِمًا يُصَلِّي الْمَكْتُوبَةَ ثُمَّ يَجْلِسُ فَيُعَلِّمُ النَّاسَ الْخَيْرَ وَالْآخِرُ يَصُومُ النَّهَارَ وَيَقُومُ اللَّيْلَ أَيُّهُمَا أَفْضَلُ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «فَضْلُ هَذَا الْعَالِمِ الَّذِي يُصَلِّي الْمَكْتُوبَةَ ثُمَّ يَجْلِسُ فَيُعَلِّمُ النَّاسَ الْخَيْرَ عَلَى الْعَابِدِ الَّذِي يَصُومُ النَّهَارَ وَيَقُومُ اللَّيْلَ كَفَضْلِي عَلَى أَدْنَاكُمْ» . رَوَاهُ الدَّارِمِيُّ
From him, in mursal form, who said: The Messenger of Allah ﷺ was asked about two men who were among the Children of Israel. One of them was a scholar who would pray the obligatory prayer, then sit and teach the people good, and the other would fast by day and stand [in prayer] by night: which of them is better? The Messenger of Allah ﷺ said: "The superiority of this scholar who prays the obligatory prayer, then sits and teaches the people good, over the worshipper who fasts by day and stands [in prayer] by night is like my superiority over the lowest of you." Reported by ad-Darimi.