modified preparation sql