• SQL Server GUIDs are Version "4" (random) and not Version "1" (MAC address).

    An advantage for using GUIDs in a .Net application is that the value can be generated anywhere within the layers. E.g., the .Net application can generate them and pass them to the database layer (as a parameter to the stored procedure). Or, if necessary, the database layer can generate them as needed. Lots of flexibility.

    Using an IDENTITY means that the database has to return the value to the caller each time. And if multiple rows are inserted, it gets cumbersome to return the list of (IDENTITY) values back to the application and for it to update the data that it has in memory.

    We also use XML as a method for passing "chunks" of data to/from the stored procedures vs. lots of scalar parameters. The .Net layer generates the unique (GUID) identifiers that are contained within the XML. Example: A Sales Order with line items for the merchandise being purchased. This would be a complete XML document that would be passed to the stored procedure which in turn would "shred" it into the proper relational tables.

    Impossible to do with IDENTITY.

    We use them extensively in the databases powering our SaaS offerings. In fact, all unique identifiers are GUIDs.


    [font="Arial Narrow"](PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.[/font]