Alias the aggregate columns so SQL Server doesn't combine them.
Compare dirname() results to DIRECTORY_SEPARATOR, not '/'
Merge pull request #5874 from owncloud/fix-5845

Fix file uploads on Windows with SQL Server