optimised lexSqlScript