I am using Sequelize with Tedious to access SQL Server 2008.
When I do a sequelizeModel.findOne()
I get this exception -
Unhandled rejection SequelizeDatabaseError: Invalid usage of the option NEXT in the FETCH statement.
I know SQL Server 2008 doesn't support OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
and that is why the exception is thrown.
But I have also explicitly set the tdsVersion
in the tedious options to 7_3_B
.
As described here -
http://pekim.github.io/tedious/api-connection.html
I've tried all the tds versions and the query syntax that is generated always contains the FETCH/NEXT
syntax.
Am I missing something?
Shouldn't the syntax be specific to the tds version?
I've also verified that the tdsVersion
option is being passed successfully to the tedious connection library from sequelize.
Example of query syntax generated -
SELECT
[id], [FIRST_NAME], [LAST_NAME]
FROM
[USERs] AS [USERS]
ORDER BY
[id]
OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY;