views:

45

answers:

2

I was curious as to how SQL Server calculates uniqueidentifiers. I understand that uniqueidentifiers, are GUIDs but are these calculated based on system time? Or are they calculated based on the name of job/script that has called the NEWID() function. I found this but i found this reference to be unclear.

+2  A: 

I find the Wikipedia entry quite informative.

Otávio Décio
I guess, when in doubt, wikipedia. Thanks
jgroat
+1  A: 

It depends on whether you are generating them from NEWID() or NEWSEQUENTIALID() (the last one uses an algorithm involving the mac address the first one doesn't)

Martin Smith
How could the GUID change? Is it possible that jobs that run on SQL Server be assigned a new GUID if the server were to be reset?
jgroat
@jgroat - No . That should remain permanent as far as I know. I assume this is related to your question yesterday? Maybe if you are seeing odd behaviour with the SQL Server jobs table post a new question describing the odd behaviour you are seeing.
Martin Smith
I'm actually trying to store data from some system tables and if the GUID changes on system restart I have to find a new way to uniquely identify each job. Thanks for your help though.
jgroat