The interplay of electron-phonon coupling and strong electronic correlations is studied in the frame of the two-dimensional Hubbard-Holstein model. Static and dynamic properties are determined by quantum Monte Carlo simulations and by Migdal-Eliashberg theory. The comparison allows us to assess the diagrammatic approach. The competition between the phonon-mediated electron-electron attraction and the local Coulomb repulsion leads to a rich phase diagram, which we study in detail for a wide range of parameters. We address the question, to which extent the systems can be described by an effective negative-U Hubbard model.