fixed mssql support

The "with" clause was causing issues when running standard queries when using MSSQL.