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
 SQL Server Development (2000)
 Deletion of records in join tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-15 : 07:21:42
Priyabrata writes "I have a database which have join tables.
Ex--
Category table is join with Product table.

CategoryTable(cat id primary) -- join table(cat id foreign, prod id foreign) -- product table(prod id primary)

And Product table is join with Sku table

ProductTable(Prod Id primary) -- Join table(Prod id foreign, Sku Id foreign) -- Sku Table(Sku Id Primary)

How can i delete Category through a single Store procedure(if i get cat id in the store procedures) .

I have tried with cursors but facing problem when tables are containing thousands of records."

X002548
Not Just a Number

15586 Posts

Posted - 2003-05-15 : 16:26:20
You can't DELETE Category if he has any children rows (and there is a foreign key established).

Unless CASCADE DELETE is set up, you'll have to DELETE the children first form your "join" table (Don't you call that table CategoryProduct?)



Brett

8-)
Go to Top of Page
   

- Advertisement -