0

As per MSDN, they describe System.Guid.NewGuid() as ..

The chance that the value of the new Guid will be all zeros or equal to any other Guid is very **low**

Will it be a bad idea to set customerID of Customer table to "uniqueidentifier" and generate the unique id using the System.Guid.NewGuid() ? How can I assure the method will generate only unique IDs ?

mmk_open
  • 1,005
  • 5
  • 18
  • 27
  • possible duplicate of [How Random is System.Guid.NewGuid()?](http://stackoverflow.com/questions/467271/how-random-is-system-guid-newguid) – Alex K. Jun 03 '11 at 11:02

1 Answers1

2

Unless you have very good reasons to use Guid as ID, I would recommend against using Guid as key. Guids take a lot of space in a database, and provide no benefit in common scenarios. Plus they do not play well with indexes.

Why don't you set the CustomerID as an integer and set it to auto-generate its value when you insert a new record?

Johann Blais
  • 9,389
  • 6
  • 45
  • 65