473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What is the purpose of the ROWGUIDCOL property?

Greetings,

What is the point of Microsoft defining a ROWGUIDCOL property that can
be attached to a 'uniqueidentifier' column? This is defined as a column
that is 'globally unique', but doesn't the uniqueidentifier datatype
already guarantee that? To make matters more confusing, they tell you
in Books Online to add a Unique constraint because ROWGUIDCOL does not
guarantee uniqueness...so what's the point?

Apparently the only functionality attached to this property is that only
one such column can exist per table and that it can be queried using the
$ROWGUIDCOL keyword in SQL.

Can anyone tell me the rationale for when to use this and when not to,
or what the purpose of this property is?

Thanks,

Sam Bendayan
DB Architect
Ultimate Software
sa**********@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Dec 4 '07 #1
2 33653
On 04 Dec 2007 16:19:48 GMT, Sam Bendayan wrote:
>Greetings,

What is the point of Microsoft defining a ROWGUIDCOL property that can
be attached to a 'uniqueidentifier' column? This is defined as a column
that is 'globally unique', but doesn't the uniqueidentifier datatype
already guarantee that? To make matters more confusing, they tell you
in Books Online to add a Unique constraint because ROWGUIDCOL does not
guarantee uniqueness...so what's the point?
Hi Sam,

Starting from the end:

* Having a column defined as uniqueidentifier with a default of NEWID()
or NEWSEQUENTIALID() does not by itself uniqueness. First, I believe
that there is some (extremely unlikely) chance that generated guid
values can be duplicates; second, SQL Server does not prevent you from
manually entering data in this column, overriding the default.

Other that that, explicitly declaring uniqueness in a column gives
several other benefits as well. It gives a wealth of information to the
optimzier regarding data distribution, it makes the column eligible as
the target of a foreign key constraint, and it automatically creates an
index that can be used to speed up queries accessing this column.
The point of setting the ROWGUIDCOL property is to enable you to use
$ROWGUID instead of the column name in a SELECT list. Frankly, I shudder
when I attempt to think of scenario's where this would be useful, since
it implies that you select from a table without knowing yourself what
column is used for what purpose. <shudder>

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Dec 4 '07 #2
Hugo Kornelis (hu**@perFact.REMOVETHIS.info.INVALID) writes:
The point of setting the ROWGUIDCOL property is to enable you to use
$ROWGUID instead of the column name in a SELECT list. Frankly, I shudder
when I attempt to think of scenario's where this would be useful, since
it implies that you select from a table without knowing yourself what
column is used for what purpose. <shudder>
It's used a by several features in SQL Server. Merge replication is one.
The new FILESTREAM feature in SQL 2008 also requires the table have a
ROWGUIDCOL.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John Salerno | last post by:
I understand how they work (basically), but I think maybe the examples I'm reading are too elementary to really show their value. Here's one from Programming C#: #region Using directives ...
10
by: tony | last post by:
Hello!! I have some demo programs written in C# and they have this construction "" see below. I haven't seen this before so what does it mean ? public bool ShowDropDownButtons { get {...
39
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
4
by: ChrisA | last post by:
I need to get the user to confirm a button push/postback with a popup from the browser, in ASP.NET 1.1. What's the right way to wire that up?? Thanks
13
by: Herman Jones | last post by:
I found this statement in some sample code. It seems to be syntactically correct. What do the brackets around "String" mean? Dim sWork As = "Some number of characters"
25
by: raylopez99 | last post by:
First in an occasional series. I'm somewhat experienced in C++, and am using .NET Visual Studio 2005 as the IDE. I'm learning C#. What I don't like about C#, compared to C++ (all flavors): ...
7
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
Dim sCoName As String = oDs.Customers(0).CompanyName The part that I want to understand is the oDs.Customers(0). Does oDs.Customers(0) mean 1st row of the datatable Customers. Where can I find...
6
by: Bhuwan Bhaskar | last post by:
Hi, I want to know what is anonymas methods and how they can be used. Thanks and regards. Bhuwan
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.