In this paper we study genericity for the class of semialgebraic optimization problems with equality and inequality constraints, in which every problem of the class is obtained by linear perturbations of the objective function, while the “core” objective function and the constraint functions are kept fixed. Assume that the linear independence constraint qualification is satisfied at every point in the constraint set. It is shown that almost all problems in the class are such that (i) the restriction of the objective function on the constraint set is coercive and regular at infinity; (ii) there is a unique optimal solution, lying on a unique active manifold, at which the strict complementarity and second order sufficiency conditions, the quadratic growth condition, and the Hölder type global error bound hold, and (iii) all minimizing sequences converge. Furthermore, the active manifold is constant, and the optimal solution and the optimal value function depend analytically under local perturbations of the objective function. These results are combined with a standard result about the existence of sums of squares certificates to prove that we can build a sequence of semidefinite programs whose solutions give rise to a sequence of points converging to the optimal solution of the original problem in finitely many steps. It is worth emphasizing that the results of this study hold globally and we do not require the problem to be convex or the constraint set to be compact.