Chinjoo
Chinjoo

Reputation: 2792

Will NEWSEQUENTIALID() SQL always generate unique ID irrespective of Host computer?

This is a generic query, My scenario is: I have a DB(MS SQL) and create a table with a column as uniqueidentifier and assign the values using NEWSEQUENTIALID(), I know it will be unique id always. But what if I am deploying the same DB on three machine (2 machines are transactional DBs and the third is replication DB). In the replication DB, I will update the column to not assign value by itself. From the two transactional DBs, I will replicate the data to the replication DB daily. NOW THE QUERY IS, will the ids generated on the two transactional DB be unique when I replicate to the replication DB. ie. is the IDs generated unique across any machine? or is that only one machine?

Upvotes: 3

Views: 1150

Answers (1)

Tom Bowen
Tom Bowen

Reputation: 8514

Yes, it will still be globally unique.

Have a look as the MSDN page for it: http://msdn.microsoft.com/en-gb/library/ms189786.aspx

By "Specified Computer" it is refering to the fact that the GUID will be greater than those previously generated. So being greater than the last generated is only guaranteed for that machine. It's uniqueness is Global.

Upvotes: 2

Related Questions