Random GUID and NEWSEQUENTIALID

  • I have a DB using random GUID values as a PK. I know it should not be that way but it is third party and I am trying to persuade them to do something else, like a sequential GUID using NEWSEQUENTIALID. My question is this. Since I have GUID values already in the database, if we change the table definition from simply uniquidentifier to NEWSEQUENTIALID what is to keep NEWSEQUENTIALID from generating a GUID that already exists and creating a PK violation?

  • Well is the primary key also the clustered index?

  • lmarkum (3/20/2015)


    I have a DB using random GUID values as a PK. I know it should not be that way but it is third party and I am trying to persuade them to do something else, like a sequential GUID using NEWSEQUENTIALID. My question is this. Since I have GUID values already in the database, if we change the table definition from simply uniquidentifier to NEWSEQUENTIALID what is to keep NEWSEQUENTIALID from generating a GUID that already exists and creating a PK violation?

    Roughly from BOL: The GUID generated by NEWSEQUENTIALID is unique only for a computer if not networked or across multiple computers if networked (has a network card)

    😎

  • Yes. The PK is clustered. In terms of the summary from BOL, I guess It would be unique in our situation. This is a SQL Cluster networked with many other clusters. I was just uncertain as to how the system would ensure it is generating a unique GUID.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply