That is not correct. Shrimada Bhagavatam Canto 10, Chapter 1 describes the cause of appearance of Lord Krishna. It states that the mother Earth was overburdened by many demons who were posing like kings. So, she approached lord Brahma to get rid of them and lord Brahma approached Lord Vishnu for the same. So, lord appeared on the earth.
brahmāṇaṁ śaraṇaṁ yayau
SB 10.1.17 — Once when mother earth was overburdened by hundreds of thousands of military phalanxes of various conceited demons dressed like kings, she approached Lord Brahmā for relief.
In the very next chapter it was confirmed that the Lord wanted to protect Yadus (a Kshatriya clan) from other demonic Kings.
yadūnāṁ kadanaṁ cakre
SB 10.2.1-2 — Śukadeva Gosvāmī said: Under the protection of Magadharāja, Jarāsandha, the powerful Kaṁsa began persecuting the kings of the Yadu dynasty. In this he had the cooperation of demons like Pralamba, Baka, Cāṇūra, Tṛṇāvarta, Aghāsura, Muṣṭika, Ariṣṭa, Dvivida, Pūtanā, Keśī, Dhenuka, Bāṇāsura, Narakāsura and many other demoniac kings on the surface of the earth.
te pīḍitā niviviśuḥ
śālvān vidarbhān niṣadhān
videhān kośalān api
SB 10.2.3 — Persecuted by the demoniac kings, the Yādavas left their own kingdom and entered various others, like those of the Kurus, Pañcālas, Kekayas, Śālvas, Vidarbhas, Niṣadhas, Videhas and Kośalas.
eke tam anurundhānā
hateṣu ṣaṭsu bāleṣu
saptamo vaiṣṇavaṁ dhāma
yam anantaṁ pracakṣate
garbho babhūva devakyā
SB 10.2.4-5 — Some of their relatives, however, began to follow Kaṁsa’s principles and act in his service. After Kaṁsa, the son of Ugrasena, killed the six sons of Devakī, a plenary portion of Kṛṣṇa entered her womb as her seventh child, arousing her pleasure and her lamentation. That plenary portion is celebrated by great sages as Ananta, who belongs to Kṛṣṇa’s second quadruple expansion.
bhagavān api viśvātmā
viditvā kaṁsajaṁ bhayam
SB 10.2.6 — To protect the Yadus, His personal devotees, from Kaṁsa’s attack, the Personality of Godhead, Viśvātmā, the Supreme Soul of everyone, ordered Yoga-māyā as follows.
So, from these references it is clear that the Lord's purpose was to kill only those who do not follow the path of Dharma (righteousness). If His intention was to kill all Kshatriyas He should not have helped Pandavas.
And finally, in Bhagavat Gita, Chapter 4, Verse 7 Lord Krishna described his purpose:
yadā yadā hi dharmasya
glānir bhavati bhārata
tadātmānaṁ sṛjāmy aham
Whenever and wherever there is a decline in religious practice, O descendant of Bharata, and a predominant rise of irreligion – at that time I descend Myself.