We present spectral line mapping observations towards four massive star-forming regionsCepheus A, DR21S, S76E and G34.26+0.15 -with the IRAM 30-m telescope at the 2 and 3 mm bands. In total, 396 spectral lines from 51 molecules, one helium recombination line, 10 hydrogen recombination lines and 16 unidentified lines were detected in these four sources. An emission line of nitrosyl cyanide (ONCN, 14 0, 14 -13 0, 13 ) was detected in G34.26+0.15, as the first detection in massive star-forming regions. We found that c-C 3 H 2 and NH 2 D show enhancement in shocked regions, as suggested by the evidence of SiO and/or SO emission. The column density and rotational temperature of CH 3 CN were estimated with the rotational diagram method for all four sources. Isotope abundance ratios of 12 C/ 13 C were derived using HC 3 N and its 13 C isotopologue, which were around 40 in all four massive star-forming regions and slightly lower than the local interstellar value (∼65). The 14 N/ 15 N and 16 O/ 18 O abundance ratios in these sources were also derived using the double isotopic method, which were slightly lower than in the local interstellar medium. Except for Cep A, the 33 S/ 34 S ratios in the other three targets were derived, which were similar to that in the local interstellar medium. The column density ratios of N(DCN)/N(HCN) and N(DCO + )/N(HCO + ) in these sources were more than two orders of magnitude higher than the elemental [D]/[H] ratio, which is 1.5 × 10 −5 . Our results show that the later stage sources, G34.26+0.15 in particular, present more molecular species than earlier stage sources. Evidence of shock activity is seen in all stages studied.