Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting a unique key to be used across tables
Message
De
28/10/2004 15:45:40
 
 
À
28/10/2004 15:35:25
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00955413
Message ID:
00955462
Vues:
16
Alan,

It's one app, but potentially hundreds of users. The app has about 10 tables that all have a column called TransactionNo. Everytime a row is inserted into any of the 10 tables, a unique TransactionNo must be determined, by accessing a one-row, one-column table and incrementing the value.

So table1 might have 3 rows of 1,3,6
table2 might have 3 rows of 2,4,10
table3 might have 4 rows of 5,7,8,9.

This is perhaps the one area where I still think from the FoxPro DBF mindset...write a function to set up a loop until you can get an RLOCK(), update the table and increment the counter, unlock, and return the value. I'm sure you can do the same thing in SQL Server and get reliable results, but I don't know exactly how.

Perry's response about setting up a check/verify loop is something I might look into.

Thanks,
Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform