This is a sequel to [30], which studies the prescribing scalar curvature problem on S". First we present some existence and compactness results for n = 4. The existence result extends that of Bahri and Coron [4], Benayed, Chen, Chtioui, and Hammami [6], and Zhang [39]. The compactness results are new and optimal. In addition, we give a counting formula of all solutions. This counting formula, together with the compactness results, completely describes when and where blowups occur. It follows from our results that solutions to the problem may have multiple blowup points. This phenomena is new and very different from the lower-dimensional cases n = 2,3.Next we study the problem for n 2 3. Some existence and compactness results have been given in [30] when the order of flatness at critical points of the prescribed scalar curvature functions K(x) is p E (n -2,n). The key point there is that for the class of K mentioned above we have completed Lm apriori estimates for solutions of the prescribing scalar curvature problem. Here we demonstrate that when the order of flatness at critical points of K(x) is = n -2, the L" estimates for solutions fail in general. In fact, two or more blowup points occur.On the other hand, we provide some existence and compactness results when the order of flatness at critical points of K ( x ) is p E [n -2,n). With this result, we can easily deduce that C" scalar curvature functions are dense in CIa (0 < a < 1) norm among positive functions, although this is generally not true in the C2 norm.We also give a simpler proof to a Sobolev-Aubin-type inequality established in [ 161.Some of the results in this paper as well as that of [30] have been announced in I291.