SB 8.24.9

jñātvā tad dānavendrasya
 hayagrīvasya ceṣṭitam
dadhāra śapharī-rūpaṁ
 bhagavān harir īśvaraḥ
Word for word: 
jñātvā — after understanding; tat — that; dānava-indrasya — of the great demon; hayagrīvasya — of Hayagrīva; ceṣṭitam — activity; dadhāra — accepted; śapharī-rūpam — the form of a fish; bhagavān — the Supreme Personality of Godhead; hariḥ — the Lord; īśvaraḥ — the supreme controller.
Translation: 
Understanding the acts of the great demon Hayagrīva, the Supreme Personality of Godhead, Hari, who is full of all opulences, assumed the form of a fish and saved the Vedas by killing the demon.
Purport: 

Because everything was inundated by water, to save the Vedas it was necessary for the Lord to assume the form of a fish.