When I run the query below, I get the database_id field for each database. I am under the impression that the value is being reused. For example, I delete databases, then I restore new databases. The database_id value for some of those newly restored databases may be an old one. Is that possible? Can that be changed?
The reason why I ask is the following. I am running a query across each DB in the SQL server. I would like to exclude some DBs and I am using the database_id field to identify those I wish to skip in the query. However, if a database_id is being reused, I must to update the query regularly. Thank you.
SELECT *
FROM sys.databases