Improving the sql to import in upload table