Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm using MS SQL 2000 with enterprise manager

 

I have a customers table called high_customer, it has a primary key called ID

 

I have an invoices table called high_invoices, it has no primary keys but it does have a column for customer ID.

 

I want to set it so if a customer is deleted from the customers table, any invoices with that customerID are deleted from the invoices table.

 

Do I need to specify a constraint? If so how do I do it in enterprise manager.

 

Thanks

Posted

Delete Rule = Cascade

 

If you haven't already, you need to add a relationship between high_invoices and high_customer.

 

When editing the columns for high_invoices, right click anywhere in the columns list, and select Relationships. Then click the ... button by Tables and Columns Specification. Set the Primary key table to high_customer, and below that select the field in high_customer you wish to relate to (customer ID). On the right select the field in high_invoices that links to the customer ID and click OK. Then, under DELETE and UPDATE specification set the Delete Rule to Cascade.

 

If you've already added the relationship, then you just need to edit the Delete Rule as described above.

 

Good luck :cool:

Never trouble another for what you can do for yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...