Forum Discussion
Using a Sequence
There are more limitations than the message mentioned, This article descripted https://learn.microsoft.com/en-us/sql/t-sql/functions/next-value-for-transact-sql?view=sql-server-ver16#limitations-and-restrictions
Since we can't see the context that you called sp, guess there might be having SET ROWCOUNT ON or something else.
rodgerkongI ran Example E in the page for "NEXT VALUE FOR" and got the same error message so the problem has nothing to do with my query. Now I am really at a loss....
- rodgerkongOct 26, 2024Iron ContributorThat's weird, did you check the permissions? Could you create a new db, grant db_owner role to do the test? And could you post whole code that you tested fail.
- SezMeOct 27, 2024Copper Contributor
rodgerkongI created a new database called AAA. I then created a new query and inserted these two lines:
USE AAA GO
Then I did a copy/paste of the code in Example A. Result: Same error message.
What permissions do I need to check? On the whole database? Something else? How?
Regarding the last question: Consider me a competent novice at SQL Server. I know how to work in SSMS but details such as permissions have not yet been gained.
- rodgerkongOct 27, 2024Iron Contributor
The permissions is OK, you create the db, you are the db owner.
Could you run these 3 script and post their results?SELECT @@VERSION
and
EXEC sp_helpdb 'AAA'
and
USE AAA GO SELECT * FROM sys.sequences