Improve MSSQL support and function declarations