Artifactory AQL can produce bad queries for MSSQL databases. The issue happens with certain queries which produce order by with duplicate entries. The result is an error and a failed AQL query.
The error is:
There is a Microsoft article https://support.microsoft.com/en-us/kb/890771 that described this error as intended behavior caused by a user error (bad query).
curl -k -X POST -u admin:password -H "Content-Type: text/plain" --data @test.aql <artifactory-url-and-port>/artifactory/api/search/aql