Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Unique key in distributed environment

Author  Topic 

samrat
Yak Posting Veteran

94 Posts

Posted - 2002-02-21 : 08:30:44
Is there any other way in which i can geenrate unique key in distributed environment other then using the GUID !!!!


Thanx

Samrat Valani

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-21 : 08:36:03
Not without writing a lot of custom code, which you have to distribute to your entire domain, and it will not perform as quickly as NEWID() will.

What kind of keys do you need? What's wrong with GUIDs/NEWID()?

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-02-21 : 08:37:27
What is wrong with a guid ?

But yes, there are a couple of ways. One is have a key that is a combination of a location ID and an identity (if that is what you are currently using).

Another way, is with Identity, you can specify the starting point and intervals. For example, if you have two locations, you can start one of them at 1, the other at 2. Then have them incerment by 2. So your records will look like this :

Server1: 1,3,5,7,9
Server2: 2,4,6,8,10

Hope that gives you some ideas

Damian
Go to Top of Page

samrat
Yak Posting Veteran

94 Posts

Posted - 2002-02-21 : 08:52:02
Thanx for the instant reply !!!

I am assured that using GUID would be an ideal solution in distributed environment, but the problem I think that i might face using them is, as my controls used in my VB application can only handle long datatype of 4 bytes and GUID's are 16bytes. So that means if i am using GUID's for unique keys then i have to go through atleast 800 controls and change the code to handle 16byte..



Samrat Valani
Go to Top of Page
   

- Advertisement -