reformat SQL statements