@SqlQuery("select next value for sync_sequence as syncId")
public abstract long getNewSyncIdentifier();
Whenever I try to get a sequence value using this method against SQL Server 2012, I get the following error:
org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: com.microsoft.sqlserver.jdbc.SQLServerException: NEXT VALUE FOR function cannot be used if ROWCOUNT option has been set, or the query contains TOP or OFFSET. [statement:"select next value for sync_sequence as syncId", located:"select next value for sync_sequence as syncId", rewritten:"select next value for sync_sequence as syncId", arguments:{ positional:{}, named:{}, finder:[]}] at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1334)
at org.skife.jdbi.v2.Query.fold(Query.java:173)
This works as expected (e.g., without error) against an H2 database.
Any ideas on workarounds? The same SQL (that is, "select next value from sync_sequence as syncId") works fine running in SQL Server Mgmt. Studio.
TIA
p