update sql to new format