I'm migrating a web based system to SQL server. I'm planning on using the SQL server function NewID() to create unique keys for many of my records in many different tables. I'm just wondering if NewID() is guaranteed to return a value that does not already exist in my database. I mean obviously once you have a certain number of records (a hell of a lot) you'd be breaking the odds to never come up with a duplicate.
Do I need to make sure the result of NEWID() doesn't already exist?
Thanks
No this algorithm is guaranteed to always return a unique value. At least for a really, really long time,
Hope this helps,
No comments:
Post a Comment