improved formatting sql query in Update service