sql - Database identification after moving it to another server -


i'm writing tool used perform several database operations.
tool should used specific database.

now i'm looking way securely identify database tool connected to.

first thought checking string servername\instance#database.
found this question solution gives guid, guid changes if db restored on server.

but should work if db moved server or instance, or if database name changes.

i'm wondering if there reliable way achieve this?

you might able achieve extended property.

to create:

exec sp_addextendedproperty @name = 'dbuniqueidentifier' @value = 'abcd1234' 

to confirm:

select value sys.extended_properties name = 'dbuniqueidentifier' 

in organization, use extended properties identify build , changeset database schema came from. properties survive backup/restore/migration.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -