Is there a Globally Unique ID in SQL Server?

  • Thread starter Jeff via AccessMonster.com
  • 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...
 
P

Philipp Stiefel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top