Influence of electronic relaxation on core and valence excited states of alkaline-earth atoms