By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

Using GUID as primary key in DB

P: n/a
I used .NET to generate a GUID for creating a new record in Access DB as primary key. Is it guaratee to be unique in the DB as the GUID is not generate in DB?? If so, is that mean GUID is generated based on machine instead of application, right??
Million Thanks
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
GUIDs are supposed to be globally unique.
Although it is theoretically possible to get a duplicate, it is extremely unlikely.
It should not matter where the GUID was generated.
--
Joe Fallon

"Grey" <er*****@i-cable.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
I used .NET to generate a GUID for creating a new record in Access DB as primary key. Is it guaratee to be unique in the DB as the GUID is not generate in DB?? If so, is that mean GUID is generated based on machine instead of application, right??
Million Thanks
Nov 18 '05 #2

P: n/a

I have one questoin... and i am not trying to start a flame or anythning..

But why would you use a GUID as the primary key? what is wrong with ints or numeric or things that sql knows how to index properly.

"Grey" <er*****@i-cable.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
I used .NET to generate a GUID for creating a new record in Access DB as primary key. Is it guaratee to be unique in the DB as the GUID is not generate in DB?? If so, is that mean GUID is generated based on machine instead of application, right??
Million Thanks
Nov 18 '05 #3

P: n/a
GUIDs keys are pretty common for situations where you need to merge similar data from multiple sources.
Imagine several identical systems running in parallel in separate parts of the country. Odds are you'll want to consolidate all that data to a central data warehouse eventually. When you merge them together, If all those databases were using numeric keys, now you've got duplicate keys. No good. If you used GUIDs for keys then you wouldn't have the problem.
There are other somewhat similar situations where GUID keys are useful too.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Darren Clark" <dc******@hotmail.com> wrote in message news:PD******************@news-server.bigpond.net.au...

I have one questoin... and i am not trying to start a flame or anythning..

But why would you use a GUID as the primary key? what is wrong with ints or numeric or things that sql knows how to index properly.

"Grey" <er*****@i-cable.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
I used .NET to generate a GUID for creating a new record in Access DB as primary key. Is it guaratee to be unique in the DB as the GUID is not generate in DB?? If so, is that mean GUID is generated based on machine instead of application, right??
Million Thanks
Nov 18 '05 #4

P: n/a
Don't worry, you can rely on the GUIDs being unique.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Grey" <er*****@i-cable.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
I used .NET to generate a GUID for creating a new record in Access DB as primary key. Is it guaratee to be unique in the DB as the GUID is not generate in DB?? If so, is that mean GUID is generated based on machine instead of application, right??
Million Thanks
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.