I have been using this for a long long time, but I couldn't find clear explanation on when it is not guaranteed unique. Here are my comments, please correct as you see fit.
Value is guaranteed to be unique(ly created) on the machine it is created. So GUIDs generated by .net app on a machine will never conflict with those that are created by SQL Server on the same machine.
In all other cases there is no guarantee. Theoretically it is always possible that if there are multiple creation sources(say applications on different computers) for the unique identifier field in a db on a different computer, there can be duplicates that'll be inserted.
EDIT: Apologies for not forming the question properly. I guess I wanted to know the probability of conflicts when generated on the same machine vs different machines, if c#'s Guid.NewGuid()
, SQL Server's newid()
,newsequentialid()
functions or any other functions by different applications are used. The 'already answered' link has one of the replies where it says he actually encountered a case where that happened. Makes you wonder how frequently that can happen.
If I have a table with a uniqueidentifier field as the pk, should I have to worry about checking for uniqueness each time I do an insert by creating a new value either by different apps or SQL Server's functions?