New/rebased/cleaned-up MS SQL Server support

Finished syncing MS SQL Server support with owncloud/core master-sqlserver.
Ready for integration.