473,549 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 'uniqueidentifi er' column? This is defined as a column
that is 'globally unique', but doesn't the uniqueidentifie r 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**********@gm ail.com

*** Sent via Developersdex http://www.developersdex.com ***
Dec 4 '07 #1
2 33687
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 'uniqueidentifi er' column? This is defined as a column
that is 'globally unique', but doesn't the uniqueidentifie r 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 uniqueidentifie r 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.R EMOVETHIS.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****@sommarsk og.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
6067
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 using System; using System.Collections.Generic; using System.Text;
10
3271
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 { return showDropDownButtons; }
39
3197
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
25607
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 paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990....
4
2253
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
1973
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
2056
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): 1/ no pointers or tracking pointers or handles--this is absurd. I realise references are by and large like tracking pointers effectively (does...
7
1924
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 more information about this?
6
1442
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
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1941
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.