main update and sql upate