locked
Row Guid in Adventure Works database RRS feed

  • Question

  • I was studying the Adventure Works database because I read it contains good examples of best practices.

    It has an ID column for each table that is auto-incrementing Primary Key. There is also a row guid which seems redundant since the ID PKs are identity columns that increment automatically and should be unique in a given table.

    What is the purpose of the row guid being used in conjunction with the ID which should be unique in a given table?

    Tuesday, May 19, 2015 6:50 PM

Answers

  • What is the purpose of the row guid being used in conjunction with the ID which should be unique in a given table?

    Hello,

    If you have a deeper look at the table design, e.g. for "Person.Address" then you will see there exists also a unique index on the "rowguid" column and in the description you will see, what's that good for: Merge replication.

    Let's say you have databases in two location somewhere around the world, where data is entered and you want to replication the data between those Locations, then you need to uniquely identify the records indendent of a technical key like the identity column and that's what can be achieved with such a GUID column.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, May 20, 2015 6:19 AM
    Answerer

All replies

  • ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.

    Refer more

    http://forums.asp.net/t/1248405.aspx

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/382a076b-8b9b-44a0-b952-28c880102efb/merge-replication-rowguid-issue?forum=sqlreplication

    http://www.mindstick.com/blog/358/Usage%20of%20ROWGUID%20and%20IDENTITY%20in%20SQL%20Server#.VVuQ6kjJGWE


    • Edited by AV111 Tuesday, May 19, 2015 7:42 PM
    Tuesday, May 19, 2015 7:36 PM
  • What is the purpose of the row guid being used in conjunction with the ID which should be unique in a given table?

    Hello,

    If you have a deeper look at the table design, e.g. for "Person.Address" then you will see there exists also a unique index on the "rowguid" column and in the description you will see, what's that good for: Merge replication.

    Let's say you have databases in two location somewhere around the world, where data is entered and you want to replication the data between those Locations, then you need to uniquely identify the records indendent of a technical key like the identity column and that's what can be achieved with such a GUID column.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, May 20, 2015 6:19 AM
    Answerer