[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Benefits of uniqueidentifier and Int

x-rays

3/20/2007 4:06:00 PM

Hello Experts,

I would like advice about when to use uniqueidentifier and when to use Int
data type columns as Keys and Foreign Keys.

Thanks in advance,

x-rays
1 Answer

Roy Harvey

3/20/2007 4:27:00 PM

0

Uniqueidentifier is used when you have to have a unique identifier
that is certain to be unique across multiple systems when you can not
check those other systems when it is generated. The standard example
is when using replication, say when new rows might be added to a table
on multiple servers. The very large down side to using
uniqueidentifier is that it is 16 bytes long and binary. This makes
it effectively unreadable by humans, and too long for an efficient
key. If you do not need the special qualities of uniqueidentifier,
don't use it.

Roy Harvey
Beacon Falls, CT

On Tue, 20 Mar 2007 09:06:12 -0700, x-rays
<xrays@discussions.microsoft.com> wrote:

>Hello Experts,
>
>I would like advice about when to use uniqueidentifier and when to use Int
>data type columns as Keys and Foreign Keys.
>
>Thanks in advance,
>
>x-rays