fixing MSSQL errors ..not a fully 100% adapter

Allowed schema plus to run using MSSQL and fix an error with regards to "sql for function"