Does anybody know if there is any unique identificator for a database that I could use to identify a database even it has been renamed or restored/copied from different server? This kind of id could be created by server when a database is created but I cannot find any.
A:
I would take a look here. I've never had to do this before but it might work. Although I imagine once its moved it might get a new ID. Not sure.
-Bryan
Bryan Corazza
2009-04-02 19:50:18
A:
You could take the approach of generating a hash based on the output of the system tables (e.g., sysobjects, syscolumns). I.e., if 2 databases have identical schemas and therefore checksums, they are considered the same. You could select which types of objects you want to examine, e.g., exclude indexes, since adding an index is not a fundamental change to the schema, whereas adding/changing/dropping a table is.
RedFilter
2009-04-03 13:55:45