Implement SQL update function