Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting a unique key to be used across tables
Message
From
28/10/2004 15:45:40
 
 
To
28/10/2004 15:35:25
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00955413
Message ID:
00955462
Views:
14
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform