sql for file preparing