Let f(x)=x2−(p+1)x+p2+p−8.
Since it is an upward shaped parabola,
f(2)=4−(p+1)2+p2+p−8<0
i.e., (p−3)(p+2)<0,
i.e., −2<p<3.
Their intersection will be:
−2<p<3
So, the integral values of p are −1,0,1,2.
Hence, their sum is 2.
(We can check that the real roots exist for the given value of p).