Do I need index or primary key?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a master table and another table that contains some of the fields of the master table. I want to first update the master table with the records that have a matching IP Address field. What I need to know is do I need to make the IP Address field my primary key? In which table or both? Or do I just need to index the field in each table? I want to do an update query and then do an append query to make new records in the master table where the IP Address field does not match. Is this a good idea? Any help you can give me would be great. Thanks in advance. Matt
 
I have a master table and another table that contains some of the fields of the master table. I want to first update the master table with the records that have a matching IP Address field. What I need to know is do I need to make the IP Address field my primary key? In which table or both? Or do I just need to index the field in each table? I want to do an update query and then do an append query to make new records in the master table where the IP Address field does not match. Is this a good idea? Any help you can give me would be great. Thanks in advance. Matt

To successfully create a two-table update query you do indeed need a
unique Index - such as a Primary Key - on the joining field. If the IP
address is unique in both tables, by all means make it the PK.

The Update query would be created by joining the two tables on IP,
changing the query to an Update query, and putting

[Tablename].[fieldname]

on the Update To line - you do need the brackets.

The Append query should be based just on the second table; you'll get
a warning message "xxx records were not appended due to key
violations" for those records where the IP already exists.
 
Back
Top