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.
- SezMeOct 25, 2024Copper Contributor
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.
- SezMeOct 25, 2024Copper Contributor
rodgerkongI think my OP was a bit misleading where I mentioned "Stored Procedure" I get the noted error message when I try to CREATE it. That is, when I run the procedure in the last code block.
I did try setting ROWCOUNT = 0 but that didn't change the result.
I've looked at the useful link you provided but I still can't identify what may be causing the error since I'm trying to create a stored procedure, not trying to run one. But I'll go over the possible causes again to see if something looks relevant.