Mondeo Posted November 15, 2006 Posted November 15, 2006 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 Quote
MrPaul Posted November 16, 2006 Posted November 16, 2006 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: Quote Never trouble another for what you can do for yourself.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.