  We present a calculation of the B and D meson decay constants in lattice QCD
with two (Nf=2) flavours of light dynamical quarks, using an O(a)-improved
Wilson action for both light and heavy quarks and a renormalization-group
improved gauge action. Simulations are made at three values of lattice spacing
a=0.22, 0.16, 0.11 fm and four values of sea quark mass in the range m_PS/m_V
\~= 0.8-0.6. Our estimate for the continuum values of the decay constants are
fBd = 208(10)(11) MeV, fBs = 250(10)(13)(^{+8}_{-0}) MeV, fDd = 225(14)(14)
MeV, fDs = 267(13)(17)(^{+10}_{-0}) MeV for Nf=2 where the statistical and
systematic errors are separately listed, and the third error for fBs and fDs
show uncertainty of determination of strange quark mass. We also carry out a
set of quenched simulations using the same action to make a direct examination
of sea quark effects. Taking the ratio of results for Nf=2 and Nf=0, we obtain
fb^{Nf=2}/fb^{Nf=0} = 1.11(6), fbs^{Nf=2}/fbs^{Nf=0} = 1.14(5),
fd^{Nf=2}/\fd^{Nf=0} = 1.03(6), fds^{Nf=2}/\fds^{Nf=0} = 1.07(5). They show a
10-15% increase in the Nf=2 results over those of Nf=0 for the B meson decay
constants, while evidence for such a trend is statistically less clear for the
D meson decay constants.
