Thanks for the question and using MS Q&A platform.
As per my understanding, your database_service_objectives table isn't creating a new row with the latest database_id and there are no issues with the tables.
Here are some possible reasons:
database_id
in sys.databases
and sys.database_service_objectives
represents a global identifier that is unique within the logical server.
DB_ID
may only be used to return the database identifier of the current database in Azure SQL Database. NULL is returned if the specified database name is other than the current database.
If the caller of DB_ID
does not own a specific non-master or non-tempdb database, ALTER ANY DATABASE
or VIEW ANY DATABASE
server-level permissions at minimum are required to see the corresponding DB_ID
row. For the master database, DB_ID
needs CREATE DATABASE
permission at minimum. The database to which the caller connects will always appear in sys.databases.
For more information, please refer to these Documentations:
https://zcusa.951200.xyz/en-us/sql/t-sql/functions/db-id-transact-sql?view=azuresqldb-current#remarks
https://zcusa.951200.xyz/en-us/sql/relational-databases/system-catalog-views/sys-database-service-objectives-azure-sql-database?view=azuresqldb-current
I hope, This response will address your query and helped you to overcome on your challenges.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.