When doing a limit and a distinct query, DBAL generates an SQL statement in the form of SELECT TOP X DISTINCT, which SqlSrv does not like at all. Simply moving the the DISTINCT back to the start fixes this issue.
As far as I can see this is caused by the preg_replace in doModifyLimitQuery. Attached is a patch that makes it slightly more aware. There may be other phrases to check for, but none that I've come across yet.
|Field||Original Value||New Value|
|Assignee||Benjamin Eberlei [ beberlei ]||Juozas Kaziukenas [ juokaz ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Assignee||Juozas Kaziukenas [ juokaz ]||Benjamin Eberlei [ beberlei ]|
|Fix Version/s||2.1.6 [ 10181 ]|
|Fix Version/s||2.2 [ 10142 ]|
|Resolution||Fixed [ 1 ]|
|Workflow||jira [ 12911 ]||jira-feedback2 [ 17740 ]|
|Workflow||jira-feedback2 [ 17740 ]||jira-feedback3 [ 20095 ]|