Is there a Globally Unique ID in SQL Server?

  • Thread starter Thread starter Jeff via AccessMonster.com
  • Start date Start date
J

Jeff via AccessMonster.com

I have a database with approx 20 tables and each table has a unique
identifier (primary key). I was wondering if there is a function in SQL
Server that generates a unique ID for the entire database (e.g. a global
identity field) so that no one primary key is duplicated in the entire
database. For example Table1 would have the following pk 1,3,4.. and Table2
would have 2,5,6,9 and Table3 would have 7,8,10...
 
Jeff via AccessMonster.com said:
I have a database with approx 20 tables and each table has a unique
identifier (primary key). I was wondering if there is a function in SQL
Server that generates a unique ID for the entire database (e.g. a global
identity field) so that no one primary key is duplicated in the entire
database. For example Table1 would have the following pk 1,3,4.. and Table2
would have 2,5,6,9 and Table3 would have 7,8,10...

Maybe you are looking for a GUID. Search the documentation for
"uniqueidentifier" or "GUID".

Cheers
Phil
 
Back
Top