473,394 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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
4 1800
> 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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sfh | last post by:
Greetings all, I have a question concerning primary key types. In the past, I have always created tables with a primary key as an "int" such as: CREATE TABLE color_id ( color_id int(10)...
1
by: sfh | last post by:
Greetings all, (I had posted this in MS SQL on accident, my apologies :( ) I have a question concerning primary key types. In the past, I have always created tables with a primary key as...
5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
0
by: Phil | last post by:
Environment: XP sp2 VS.Net 2005 (Asp.Net 2.0 - c#) Sql Server 2005 Scenario: -Table (Table1) with two columns: Table1Id <- Primary Key Column1
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
8
by: brucedodds | last post by:
I've inherited an A2003 application with linked SQL Server 2000 tables in the back end, using the Microsoft SQL Server ODBC driver. We've set up a test SQL Server database. I'd like to automate...
8
bilibytes
by: bilibytes | last post by:
Hi everyone, I'm facing a database design problem. I want to make a sort of networking solution for the clients of my site in which they would be able to share or keep private some of their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.