in emphasises location
Because "this school" can be a physical place as well as an organisation, the meaning of "in" and "at" in these sentences is subtly different.
When dealing with an ambiguous subject like "this school" or "the Louvre", the use of "in" more strongly implies a location. Thus, saying "in this school" leads the reader to think of the physical buildings, rather than the organisation.
- "I have studied in this school for ten years": the study happened in the school's buildings. This is true, even if you have been sneaking into their empty classrooms in the evenings
- "I have studied at this school for ten years": the study was arranged by the people who run the school; the statement is still true if you're enrolled in a distance-learning scheme and have never visited the buildings
Of these two options, the second describes a more common situation, which is why most people would say it's the "correct" form... unless, of course, you really want to say exactly what the first one means.