More work on the mssql script