edited sql script