By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,376 Members | 3,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,376 IT Pros & Developers. It's quick & easy.

Changing information on a Primary field and having the Secondaty field updated

P: n/a
I am using Employee_Number as a primary field in one table and in another
table I have a field with the same name that it references in a one to many
relationship. How do I change the primary field and update all the secondary
fields at the same time ?
Would referential integrity have anything to do with this ?
Any help is appreciated,

Thanks

Omey
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> Would referential integrity have anything to do with this ?
Yes it would. You need to have referential integrity checked and include Cascade Update
Related Fields checked as well.

However, a well chosen primary key should never *need* to be changed. Just a design
concern that you might want to consider in the future.

______________________________________

"Omey Samaroo" <no****@replytogroup.com> wrote in message
news:Nn*******************@news04.bloor.is.net.cab le.rogers.com...
I am using Employee_Number as a primary field in one table and in another
table I have a field with the same name that it references in a one to many
relationship. How do I change the primary field and update all the secondary
fields at the same time ?
Would referential integrity have anything to do with this ?
Any help is appreciated,

Thanks

Omey

Nov 12 '05 #2

P: n/a
thanks Tom, does this mean that if I change the Employee_Number in the
primary key field that it will change the Employee_Number in all the
referenced tables if Cascade Update is checked on?
"Tom Wickerath" <AOS168RemoveThisSpamBlockmcast.net> wrote in message
news:g9********************@comcast.com...
Would referential integrity have anything to do with this ? Yes it would. You need to have referential integrity checked and include

Cascade Update Related Fields checked as well.

However, a well chosen primary key should never *need* to be changed. Just a design concern that you might want to consider in the future.

______________________________________

"Omey Samaroo" <no****@replytogroup.com> wrote in message
news:Nn*******************@news04.bloor.is.net.cab le.rogers.com...
I am using Employee_Number as a primary field in one table and in another
table I have a field with the same name that it references in a one to many relationship. How do I change the primary field and update all the secondary fields at the same time ?
Would referential integrity have anything to do with this ?
Any help is appreciated,

Thanks

Omey

Nov 12 '05 #3

P: n/a
Yes, that is what you should see happening. Another way of thinking of Referential
Integrity (RI) is simply "no orphans", as in no orphan records allowed. For example, if
you have a table of Customers and Orders (see the Northwind.mdb sample database) and you
edit a customer's primary key, your change will be "cascaded" to all related tables in
order to maintain RI. Without RI enforced, you could easily end up with records in the
Orders table that had no known customer. Not a good situation.

________________________________________

"Omey Samaroo" <no****@replytogroup.com> wrote in message
news:Jh********************@news04.bloor.is.net.ca ble.rogers.com...

thanks Tom, does this mean that if I change the Employee_Number in the
primary key field that it will change the Employee_Number in all the
referenced tables if Cascade Update is checked on?
________________________________________

"Tom Wickerath" <AOS168RemoveThisSpamBlockmcast.net> wrote in message
news:g9********************@comcast.com...
Would referential integrity have anything to do with this ?


Yes it would. You need to have referential integrity checked and include Cascade Update
Related Fields checked as well.

However, a well chosen primary key should never *need* to be changed. Just a design
concern that you might want to consider in the future.

______________________________________

"Omey Samaroo" <no****@replytogroup.com> wrote in message
news:Nn*******************@news04.bloor.is.net.cab le.rogers.com...

I am using Employee_Number as a primary field in one table and in another
table I have a field with the same name that it references in a one to many
relationship. How do I change the primary field and update all the secondary
fields at the same time ?
Would referential integrity have anything to do with this ?
Any help is appreciated,

Thanks

Omey
Nov 12 '05 #4

P: n/a
Thanks very much Tom
"Tom Wickerath" <AO***********************@comcast.net> wrote in message
news:n6********************@comcast.com...
Yes, that is what you should see happening. Another way of thinking of Referential Integrity (RI) is simply "no orphans", as in no orphan records allowed. For example, if you have a table of Customers and Orders (see the Northwind.mdb sample database) and you edit a customer's primary key, your change will be "cascaded" to all related tables in order to maintain RI. Without RI enforced, you could easily end up with records in the Orders table that had no known customer. Not a good situation.

________________________________________

"Omey Samaroo" <no****@replytogroup.com> wrote in message
news:Jh********************@news04.bloor.is.net.ca ble.rogers.com...

thanks Tom, does this mean that if I change the Employee_Number in the
primary key field that it will change the Employee_Number in all the
referenced tables if Cascade Update is checked on?
________________________________________

"Tom Wickerath" <AOS168RemoveThisSpamBlockmcast.net> wrote in message
news:g9********************@comcast.com...
Would referential integrity have anything to do with this ?
Yes it would. You need to have referential integrity checked and include

Cascade Update Related Fields checked as well.

However, a well chosen primary key should never *need* to be changed. Just a design concern that you might want to consider in the future.

______________________________________

"Omey Samaroo" <no****@replytogroup.com> wrote in message
news:Nn*******************@news04.bloor.is.net.cab le.rogers.com...

I am using Employee_Number as a primary field in one table and in another
table I have a field with the same name that it references in a one to many relationship. How do I change the primary field and update all the secondary fields at the same time ?
Would referential integrity have anything to do with this ?
Any help is appreciated,

Thanks

Omey

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.