finish inserting into SQL