PC Review


Reply
Thread Tools Rate Thread

Confused about Relationships

 
 
Jonathan Wood
Guest
Posts: n/a
 
      7th May 2008
Most of my DB experience is many years ago with Access. SQL's fine but I
find managing relationships awkward and confusing.

Anyway, I've created a table that is on the many side of a one-to-many
relationship. So it contains a foreign key that references a primary key in
the table that is on the one side. I think I understand all this. But now I
want to implement cascading deletes. I can set this, but all of a sudden,
I'm not 100% sure which way that goes.

Do cascading deletes always imply that the row in the foreign table gets
deleted when the matching row with the primary key gets deleted? I think
this is right. But is it ever possible to go the other way? Is this ever
specified, or is it always implied that it will work as I have described?

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

 
Reply With Quote
 
 
 
 
PvdG42
Guest
Posts: n/a
 
      7th May 2008
"Jonathan Wood" <(E-Mail Removed)> wrote in message
news:%23RsTFp%(E-Mail Removed)...
> Most of my DB experience is many years ago with Access. SQL's fine but I
> find managing relationships awkward and confusing.
>
> Anyway, I've created a table that is on the many side of a one-to-many
> relationship. So it contains a foreign key that references a primary key
> in the table that is on the one side. I think I understand all this. But
> now I want to implement cascading deletes. I can set this, but all of a
> sudden, I'm not 100% sure which way that goes.
>
> Do cascading deletes always imply that the row in the foreign table gets
> deleted when the matching row with the primary key gets deleted? I think
> this is right. But is it ever possible to go the other way? Is this ever
> specified, or is it always implied that it will work as I have described?
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>


This (and others) article may be helpful.

http://msdn.microsoft.com/en-us/library/aa933119(sql.80).aspx

If you go here:

http://www.microsoft.com/sql/default.mspx

then, search for "cascading deletes", you'll find numerous articles.

 
Reply With Quote
 
Jonathan Wood
Guest
Posts: n/a
 
      13th May 2008
Marc,

> No, you got it backwards :-) Cascading delete will be defined so that
> if the parent row is deleted (the one you reference with the foreign
> key), all the rows in the child table that reference it also get
> deleted. After all, with the parent row they reference gone - what are
> they referencing??


Okay, yeah. I used the incorrect terminology. I'm still getting used to the
idea of terms like "foreign key."

> In many cases, a cascading delete can make good business sense.


Right, I've used the basic idea before. But, all of a sudden I drew a blank
as to what determines which direction the cascades go.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

 
Reply With Quote
 
Jonathan Wood
Guest
Posts: n/a
 
      13th May 2008
Sorry. I read that several times but am still not sure what you are saying.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news8EC0170-C6B7-4E6A-8EE7-(E-Mail Removed)...
> Jonhathan,
>
> What do you want to do as a row is a childrelation of two different
> parentrows?
>
> Cor
>
> "Jonathan Wood" <(E-Mail Removed)> schreef in bericht
> news:%23RsTFp%(E-Mail Removed)...
>> Most of my DB experience is many years ago with Access. SQL's fine but I
>> find managing relationships awkward and confusing.
>>
>> Anyway, I've created a table that is on the many side of a one-to-many
>> relationship. So it contains a foreign key that references a primary key
>> in the table that is on the one side. I think I understand all this. But
>> now I want to implement cascading deletes. I can set this, but all of a
>> sudden, I'm not 100% sure which way that goes.
>>
>> Do cascading deletes always imply that the row in the foreign table gets
>> deleted when the matching row with the primary key gets deleted? I think
>> this is right. But is it ever possible to go the other way? Is this ever
>> specified, or is it always implied that it will work as I have described?
>>
>> Thanks.
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Confused about Print Relationships =?Utf-8?B?UGFt?= Microsoft Access 3 8th May 2006 09:24 AM
Confused Newbie - Very Confused:( Wizard Microsoft Access Forms 0 20th Oct 2005 11:37 AM
Confused about one-to-many or many-to-many relationships CAD Fiend Microsoft Access Database Table Design 4 7th Jul 2005 04:38 PM
Confused, need valid logon for OE, confused.. Rob Windows XP General 1 3rd Nov 2003 03:15 AM
relationships disappearing in relationships view Em Bond Microsoft Access 1 25th Jul 2003 07:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:54 PM.