Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Delete Linking tables in one SP

Author  Topic 

liuyang
Starting Member

6 Posts

Posted - 2003-01-28 : 03:04:12
Dear experts:
I just start to learn stored procedure and use it in my project
now i have a problem
there are three tables course,coursetype,and coursepricehistory
the course table is the parent table to coursetype with the key courseid,and coursetype table is the parent table to coursepricehistoy with the key coursetypeprice
which means one course record may have several coursetype records related to it and one coursetype record may have several courseprice records related to it.what i need to do is when deleting a course record the related coursetype records will be also deleted and the coursepricehistory records related to those coursetype records will also by deleted.so how to do this in one stored procedure?
thanks

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-28 : 03:25:49
Dear beginner!

It's obvious that you haven't yet oppened a thing called Books On Line, and it's obvious too that you don't have any experience in administering RDBMS.
But it's obvious that you've jumped hedfirst into a project without having knowledge of the simplest functionality of your database server.

Anyway, in hope that someday you will find and open the mother of all SQL books, I send you this: "discover the beauty of CASCADE DELETE"

Go to Top of Page

liuyang
Starting Member

6 Posts

Posted - 2003-01-28 : 03:30:02
Thanks for your advice
anyway i will need more advices like this when my project goes on

Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-28 : 03:31:42
Some just don't ever get it...

Go to Top of Page

liuyang
Starting Member

6 Posts

Posted - 2003-01-28 : 03:50:06
Solved

Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-01-28 : 08:22:52
Save your breath, rihardh, some people just dont get sarcasm!

OS

Go to Top of Page
   

- Advertisement -