Skip to content


DBAL-416: [GH-249] Fixed doModifyLimitQuery for SQLServerPlatform #1610

doctrinebot opened this Issue · 2 comments

2 participants


Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of norzechowicz:

Url: #249


It seems that there is a problem in SQLServerPlatform doModifyLimitQuery method.
I can't use Doctrine ORM Paginator because of wrong position of DISTINCT statement in final limit subquery, here is the exception message I'm getting.
SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'DISTINCT'.

My proposition is to change doModifyLimitQuery result from:

SELECT ** FROM (SELECT ROW_NUMBER() OVER (ORDER BY username DESC) AS doctrine_rownum, ** FROM user) ...


SELECT ** FROM (SELECT **, ROW*NUMBER() OVER (ORDER BY username DESC) AS doctrine*rownum FROM user) ...


Comment created by @beberlei:

A related Github Pull-Request [GH-249] was closed


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3.3 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.