Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record Lock
Message
De
03/03/2003 11:07:09
 
 
À
03/03/2003 10:10:50
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00760359
Message ID:
00760384
Vues:
10
>Hello all, I use a table to keep track of my primary keys. Basically the table contains a field for the tablename and a field for the next available primary key. Is there a way to lock the sql server record until I update it? Also can I run a loop checking the status of the lock so I can grab another lock as soon as the first lock is complete? Thanks for the help.

Randy,

If you are using SQL 2000, do the Read/Increment/Update in one command so the row level locking will keep different users from getting multiples. We have been doing this for a while and no dups yet.

Here is an example:
update sy_uniqueid
		set
			last_id = last_id + @Increment,
			@KeyValue = last_id + @Increment
		from
			sy_uniqueid
		where
			tablename = @Name
Of course you will have to declare the variables properly.

BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform