473,324 Members | 2,548 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,324 software developers and data experts.

Deleting foreign key record

103 100+
Hi all,.

I have a table Student and the primarykey is studid..

This studid is the foreign key in another table called Class.

I want to delete the records in the table Class...

How can i do it..

Please help me...

Regards,

Mathew
Nov 13 '07 #1
5 2300
jamesd0142
469 256MB
you'll need to drop the foreign keys between the two tables delete the required data, and add the foriegn keys once again.
Nov 13 '07 #2
mathewgk80
103 100+
you'll need to drop the foreign keys between the two tables delete the required data, and add the foriegn keys once again.
Hi James,

Is that the only method to delete those records??

Regards,
Mathew
Nov 13 '07 #3
jamesd0142
469 256MB
What error are you getting when you try to delete these records?

this will help me determine if i have suggested the correct method...

because you shouldnt really get any issues deleting a row frm the table 'class'

i can see y u wud get an error deleting a record from Student table however.
Nov 13 '07 #4
mathewgk80
103 100+
What error are you getting when you try to delete these records?

this will help me determine if i have suggested the correct method...

because you shouldnt really get any issues deleting a row frm the table 'class'

i can see y u wud get an error deleting a record from Student table however.
Hi all,


I didnt try to delete record.. i have to do it,, before that i would like to know whether it is possible or not.....

regards,
Mathew
Nov 13 '07 #5
jamesd0142
469 256MB
Hi all,


I didnt try to delete record.. i have to do it,, before that i would like to know whether it is possible or not.....

regards,
Mathew

Ok, well as i said above, i can's see any problems with deleting from the 'class' table, although you might have a problem deletiung from the 'student' table because;

The studid field in the 'class' table would no longer have a lookup, so droping the foriegn keys first would allow you to delete a record in 'student', although if you have a value in the 'class' table for studid thats not in the 'student' table you 'shouldnt' be able to create the foriegn keys once again...

i hope you understand my logic here :s
Nov 14 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: vishnu mahendra | last post by:
I have two table both say A and B. If i insert a record in A that record should be inserted in B. If i delete a record in A that record should be deleted from B. Is that possible.If yes please...
1
by: James E | last post by:
I have a question about best practices of how to deal with lookup data from my C# apps. On a couple of occasions I have come across a problem where I have to automate inserting a record into a...
5
by: Alex | last post by:
Hi, I have two tables , A and B where table B has a foreign key constraint to table A. I want to delete all records in table A that are older than a certain date that are not referenced by...
2
by: Ed Havelaar | last post by:
Hi, Hope someone can help. Here's the scenario: I have two MSAccess tables MainTab and SubTab. MainTab has an autonumber 'id' column as primary key. Subtab has this id column as a foreign...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
10
by: Shawn Chisholm | last post by:
Hi, I am trying to deal with a deadlock situation caused by foreign key references on insert and I was wondering if anyone knows what order the foreign keys are locked (or evaluated) in for a...
46
by: DP | last post by:
hi, i've got a form, with a subform in it. i've got a delete button in the subform. the code i;ve got is; Private Sub cmdDeleteRecord_Click() msg = "Are you sure you want to delete this...
1
by: rbarber | last post by:
I have to synchronize 2 databases hourly but am having difficulty maintaining foreign key relations. These tables use auto-increment columns as primary keys, with child records in other tables...
2
by: Shahid Murtaza | last post by:
i two tables master and detail linked by foreign key, i want when i delete the record in master table then associating detail record should also be deleted, please help me.
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.