Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS SQL Server Row GUID Column

I apologize for asking what seems like a tired question, but no forum response or documentation I've read seems to provide an adequate answer.

What is the purpose of the Row GUID Column property in MS SQL Server 2008?

Let me extend on that. I've seen "Don't use GUID as the PK" repeated as the answer for this question, which seems to be completely unrelated to me. If I set Row GUID Column is it forcing that GUID column to be the primary key or something?

To rephrase my original question: If I have a GUID column in my table that does not play any role in indexing, do I stand to gain anything from setting that GUID column as the Row GUID Column?

like image 769
instantmusic Avatar asked Dec 14 '10 18:12

instantmusic


People also ask

What is row GUID column?

RowGUID column is used for replication. It allows the replication engine to merge correctly. When replication is enabled this column will be added to tables that do not already have a RowGUID column. You will not gain anything by using it unless you are planning to implement replication.

What is row GUID in SQL?

GUID is a 16 byte binary SQL Server data type that is globally unique across tables, databases, and servers. The term GUID stands for Globally Unique Identifier and it is used interchangeably with UNIQUEIDENTIFIER.

What is GUID column in SQL Server?

The globally unique identifier (GUID) data type in SQL Server is represented by the uniqueidentifier data type, which stores a 16-byte binary value. A GUID is a binary number, and its main use is as an identifier that must be unique in a network that has many computers at many sites.

What is a row GUID?

RowGuids (uniqueidentifier) are large fields (16 bytes) and are basically going to ALWAYS be unique. SQL Server adds a RowGUID column to all tables if you are using Merge Replication (but doesn't add an index). RowGuids in general slow things down. Some people may consider using a RowGuid as their primary key.


1 Answers

It enables you to use the $ROWGUID variable instead of the column name. It's used mostly for merge replication. It doesn't force the GUID column for PK, you can only declare PKs explicitly. The answer to your last question is no, unless you plan on implementing Merge Replication.

like image 113
suhprano Avatar answered Sep 22 '22 22:09

suhprano