Skip to content

"Incorrect syntax near 'OFFSET'. Invalid usage of the option NEXT in the FETCH statement" #16

Description

@VictorioBerra

I get this error when I click a column sort 3 times. It sorts ASC on first click, the DESC, then error.

The generated SQL is:

SELECT
    [InventoryServer].[Id] as 'InventoryServer.Id',
    [InventoryServer].[Name] as 'InventoryServer.Name',
    [InventoryServer].[DockDate] as 'InventoryServer.DockDate',
    [InventoryServer].[BillingStartDate] as 'InventoryServer.BillingStartDate',
    [PatchPartyDowntime].[Name] as 'PatchPartyDowntime.Name',
    [VirtualEnvironment].[Description] as 'VirtualEnvironment.Description'
    -- Many more redacted
FROM
    [InventoryServer]
    LEFT JOIN [ContactGroup] ON [ContactGroup].[Id] = [InventoryServer].[ContactGroupId]
    LEFT JOIN [DisasterRecoveryTeir] ON [DisasterRecoveryTeir].[Id] = [InventoryServer].[DisasterRecoveryTeirId]
    LEFT JOIN [Domain] ON [Domain].[Id] = [InventoryServer].[DomainId]
    -- Many more redacted
WHERE
    (1 = 1) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY

It appears the order by is ripped away as a part of removing the sort on my third click.

Let me know if you need more code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions