fix for mssql and db2 queries