Skip to content

Commit

Permalink
Merge pull request #218 from adelkhayata76/patch-1
Browse files Browse the repository at this point in the history
Fix an issue of adding OFFSET keyword for legacy SQL Server versions
  • Loading branch information
mShan0 committed Jan 10, 2023
2 parents 54ef30d + f59b59b commit 17bb0c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mssql/compiler.py
Expand Up @@ -364,7 +364,7 @@ def as_sql(self, with_limits=True, with_col_aliases=False):
# Django 2.x. See https://github.com/microsoft/mssql-django/issues/12
# Add OFFSET for all Django versions.
# https://github.com/microsoft/mssql-django/issues/109
if not (do_offset or do_limit):
if not (do_offset or do_limit) and supports_offset_clause:
result.append("OFFSET 0 ROWS")

# SQL Server requires the backend-specific emulation (2008 or earlier)
Expand Down

0 comments on commit 17bb0c8

Please sign in to comment.