• Lynn Pettis - Monday, January 16, 2017 9:26 AM

    I don't necessarily like GUIDs as keys but I get tired of people just dismissing them completely.  There are times that using a GUID as a primary key actually makes sense.  As in all things, it depends.  It all comes down to making the correct decisions when building a database solution to meet business requirements.

    I used GUIDs because they allow easier tracking across databases and external servers.  For example I can tag export or import files with a FileUID and carry that FileUID across servers or databases without fear (just anxiety 🙂 ) of conflict.

    They can also be usefull for editing records offline and re-syncing back to the main server.

    They are also nice for restoring data in a table (like an accidental delete query) and not worrying about keys getting regenerated of conflicting with existing data.

    I add a GUID to all my tables, not always because I have an immediate need for them but for later use.

    Btw - I never use a GUID for a clustered index but if my dataset is mostly static or very small then maybe I would and cringe a little.