Convert to valid sql statements