To be registered in the Swedish Population Register as a student, you need to show that you will be studying and it should be assumed that you will be living in Sweden for at least one year.
The required documents to bring to the service office (servicekontor) depend on whether you move by yourself or if you move with your family member.