repaired sql