Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unique primary key

Status
Not open for further replies.

mcjules1

Technical User
Apr 7, 2003
1
CA
Hello,

I have different tables (let's say 3) in which I have a field that is called DID and that is my primary key. This field exists in the 3 tables; I'd like this field to be unique in my 3 tables. (I don't want the DID field to have the same value (this is an auto increment number) in any of my 3 tables). I don't know if it's really clear (sorry I'm French): if for example DID's values in the first table are 1, 2 and 3, I don't want 1, 2 and 3 to be assigned to DID in the 2 other tables.

Thank you for your help.
 
w/o knowing more than I need to (or even want to) about the overall issue, there are at least a few approaches here. Perhaps hte easiest would be to creade a new (fourth) table with the "DID" value and retrieve, increment and update the value in this table for each record addition in each of the other three tables. You DO ned to be somewhat careful in the exercise, as the "DID" table needs to be locked during the record manipulation exercise which obtains a new "DID" value. Otherwise it would be possible for two users to get / update the same value from the table, thus duplicating the unique key.

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top