A search is performed for heavy Majorana neutrinos (N) decaying into a W boson and a lepton using the CMS detector at the Large Hadron Collider. A signature of two jets and either two same sign electrons or a same sign electron-muon pair is searched for using 19.7 fb-1 of data collected during 2012 in proton-proton collisions at a centre-of-mass energy of 8TeV. The data are found to be consistent with the expected standard model (SM) background and, in the context of a Type-1 seesaw mechanism, upper limits are set on the cross section times branching fraction for production of heavy Majorana neutrinos in the mass range between 40 and 500 GeV. The results are additionally interpreted as limits on the mixing between the heavy Majorana neutrinos and the SM neutrinos. In the mass range considered, the upper limits range between 0.00015-0.72 for |VeN|2 and 6.6×10-5-0.47 for |VeNV * µN|2/(|VeN|2+|VµN|2), where V ℓN is the mixing element describing the mixing of the heavy neutrino with the SM neutrino of flavour ℓ. These limits are the most restrictive direct limits for heavy Majorana neutrino masses above 200 GeV.