Deleting records from related tables

Hi all,
I use MSSQL 7 server and I have created two related tables (primary-foreign key). What I wanna do is when I delete a record at the table with the primary key, automatically the record at the table with the foreign key to be deleted. I know that this is possible, but i dont know what command to give in order to achieve it. Any help/ideaS?

Thanx

athan

Comments

  • : Hi all,
    : I use MSSQL 7 server and I have created two related tables (primary-foreign key). What I wanna do is when I delete a record at the table with the primary key, automatically the record at the table with the foreign key to be deleted. I know that this is possible, but i dont know what command to give in order to achieve it. Any help/ideaS?
    :
    : Thanx
    :
    : athan
    :
    Hi!

    You need to set up a delete trigger on the table with the primary key. The code in the trigger will delete the row in the table with the foreign key.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion