Creating AppendRegistrationRanges SQLQuery