We consider the production of second-harmonic light in gratings resonant with the generated field, through a Green’s function approach. We recover some standard results and obtain new limits for the uniform grating case. With the extension to nonuniform gratings, we find the Green’s function for the second harmonic in a grating with an arbitrary phase shift at some point. We then obtain closed form approximate expressions for the generated light for phase shifts close to π/2 and at the center of the grating. Finally, comparing the uniform and phase-shifted gratings with homogeneous materials, we discuss the enhancement in generated light and the bandwidth over which it occurs, and the consequences for second-harmonic generation in optical fiber Bragg gratings.