0

Is it possible GUID to conflict?

Actually i am generating GUID from two different applications and merge it in other database.

So, GUID column to be unique, Is there any chance it to be conflict?

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
Sohel Pathan
  • 367
  • 3
  • 13

1 Answers1

1

That depends on how you created the Guids. If you use correct procedures (Guid.NewGuid() in .NET), it should be so staggeringly unlikely that they collide that you don't need to worry about it, unless you have enough time to keep generating them that the sun expanding and destroying the earth is a more immediate concern. Planetary destruction can play havoc with the unique constraints on your database.

However, here's a Guid: "000...0120" (all ... are zeros); here's another: "000...0120". In this case: definitely not unique.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • So, should i generate GUID from a single application ? – Sohel Pathan Sep 25 '13 at 08:05
  • @SohelPathan no, I didn't say that. It shouldn't matter how many computers, processes, app-domains, applications, etc are generating guids. What matters is *how* they are generating guids. – Marc Gravell Sep 25 '13 at 08:34
  • I am generating GUID using Guid.NewGuid() in my C# Code. and store in SQL database for userId field with type = uniqueidentifier. Other database is of MS-Access and SQL lite, these are also generating UserIds. After that i have a synchronization process in which, i am merging all the UserIds. So can they collide? – Sohel Pathan Sep 25 '13 at 09:36