DB2 delete cascading not working



IBM's flagship relational database management system

DB2 delete cascading not working

Postby alwin007 » Sat Dec 05, 2009 3:39 am

Hi I am creating four tables :

event (ecode, edesc, elocation, edate, etime, emax)
spectator (sno, sname, semail)
ticket (tno, ecode, sno)
cancel (tno, ecode, sno, cdate, cuser)

I have set ecode as PRIMARY KEY for event and tno for Ticket and sno for Spectator.
I added delete cascade in ticket for ecode and sno but it works fine with sno, that is when i delete a spectator the attribute is deleted from the child table too but the same is not happening with event:

CREATE TABLE ticket (
tno INT NOT NULL,
ecode CHAR(4) NOT NULL,
sno INTEGER NOT NULL,
CONSTRAINT ticket_pk PRIMARY KEY (tno),
FOREIGN KEY (ecode) REFERENCES event
ON DELETE CASCADE,
FOREIGN KEY (sno) REFERENCES spectator
ON DELETE CASCADE
);

What am i doing wrong?Please help
alwin007
 
Posts: 1
Joined: Sat Dec 05, 2009 3:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: DB2 delete cascading not working

 

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post