elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

Using Elsa 2.15 in. net9 and encountering errors in SQL Server 2012

Open zhanghaipeng666 opened this issue 8 months ago • 1 comments

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

Image

zhanghaipeng666 avatar Mar 11 '25 09:03 zhanghaipeng666

Thanks for reporting this!

The error you're seeing:

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

...typically happens when the database is running in an older compatibility mode that doesn't support the OFFSET ... FETCH NEXT syntax used by EF Core 9 for pagination. Although you're using SQL Server 2012, it's likely that the compatibility level of your database is set lower than 110 (e.g., 100, which corresponds to SQL Server 2008).

To resolve this, you can update the compatibility level of your database to 110 by running the following SQL command:

ALTER DATABASE [YourDatabaseName] SET COMPATIBILITY_LEVEL = 110;

You can verify the current compatibility level with:

SELECT compatibility_level
FROM sys.databases
WHERE name = 'YourDatabaseName';

Alternatively, you could take control by generating your own EF Core migrations tailored to your environment.

Let us know if that helps!

sfmskywalker avatar Apr 01 '25 22:04 sfmskywalker