update function to call SP