Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
objkiran
Starting Member
11 Posts |
Posted - 2005-04-05 : 10:51:06
|
| Hello all,1. using is using uniqueidentifier datatype a good practice?2. What are the chances of a duplicate record in uniqueidentifer in more than 2 serves? |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-04-05 : 11:02:06
|
Look it up in BOL, it lists all the pros and cons1. No unless you need global uniqueness, but you can still have the same "value" in 1 or more tables2. 0.0000000000000000000000000000000000%AndyBeauty is in the eyes of the beerholder |
 |
|
|
objkiran
Starting Member
11 Posts |
Posted - 2005-04-05 : 14:54:33
|
| Little confused with your answer, if same value is in one or more table then how is it chances for duplucate is 0.0000000000000000000000000000000000% ? |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-04-05 : 16:18:20
|
| Good answer Andy."value" - You have to have something with business meaning that uniquely identifies a record.Just having a GUID as the only PK/UNIQUE CONSTRAINT is very bad practice.GUID is just a 16-byte value that can serve as surrogate key,so most of the time it's just a waste of space,unless You need globally unique surrogates.rockmoose |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-04-05 : 18:37:04
|
| There is also an extremely small, but real chance that uniqueidentifer will not be unique, even in the same table, since uniqueidentifer has "only" about 3.4E+38 possible unique values.CODO ERGO SUM |
 |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-04-06 : 01:52:04
|
quote: Originally posted by objkiran Little confused with your answer, if same value is in one or more table then how is it chances for duplucate is 0.0000000000000000000000000000000000% ?
You asked if it could be duplicated in 2 servers, the answer to which is NO. But it can exist in the same table if a PK or a UNIQUE CONSTRAINT are not defined.As I said look it up in BOL. Also see rockmoose's replyMichael - are you sure about this?Quote from BOLThe main advantage of the uniqueidentifier data type is that the values generated by the Transact-SQL NEWID function or the application GUID functions are guaranteed to be unique throughout the world.Pretty bold statement if it isnt trueAndyBeauty is in the eyes of the beerholder |
 |
|
|
|
|
|