Based on density functional theory, we have studied the structural stability, elastic, mechanical, and lattice dynamical properties of BeB2, NaB2, and CaB2 compounds in AlB2, OsB2, and ReB2 structures, respectively. Generalized gradient approximation has been used for modeling exchange-correlation effects. Our calculations indicate that ReB2, AlB2, and OsB2 structures are energetically the most stable for BeB2, NaB2, and CaB2 compounds, respectively. The results show that these structures are both mechanically and dynamically stable. The bulk modulus, elastic constants, shear modulus, Young's modulus, Poisson's ratio, Debye temperature, sound velocities, and anisotropic factors are also calculated and discussed. Furthermore, the phonon dispersion curves and corresponding phonon density of states are presented. Our structural and some other results are in agreement with the available experimental and theoretical data. (C) 2011 Elsevier Ltd. All rights reserved.