2. The number of triangles with integer side lengths and a perimeter of 20 is ( ).
(A) 4
(B) 6
(C) 8
(D) 12
2. C.

Let the three sides of a triangle be $a, b, c(a \geqslant b \geqslant c)$. From $a+b+c=20 \Rightarrow a \geqslant 7$.
Also, $a+b>a, 2a<20 \Rightarrow a<10$, thus $7 \leqslant a \leqslant 9$.
Therefore, we can list
$$
\begin{array}{l}
(a, b, c) \\
=(9,9,2),(9,8,3),(9,7,4),(9,6,5), \\
\quad(8,8,4),(8,7,5),(8,6,6),(7,7,6),
\end{array}
$$

a total of eight sets.