DF#QCADOOCLS-1806 Some fixes in sql.