aikixd
aikixd

Reputation: 514

SQL server, data integrity - table referenced by many tables

I have a table which has some generic data, that must be referenced by a multiple number of other tables. The referenced table can't be simplified to fit columns of the referencing tables. How do I enforce data integrity and relationships in such a scenario?

Edit

By saying that the table can't be simplified, I meant that it is not possible to store the needed data in the tables that need that data and get rid of the referenced table.

Upvotes: 0

Views: 81

Answers (2)

Tab Alleman
Tab Alleman

Reputation: 31785

Two very flexible ways to enforce RI are with:

  1. Check Constraints - you can write UDFs that encapsulate the logic you want to enforce, and the constraint just checks the UDF for a true or false.

  2. Triggers - The RI logic is written into the trigger code.

Upvotes: 1

Jim Horn
Jim Horn

Reputation: 889

-> must be referenced by a multiple number of other tables.

Okay, so there must be common column(s) between 'a table' and 'other tables' so you can create a foreign key relationship.

-> The referenced table can't be simplified to fit columns of the referencing tables.

Really not sure what you mean here, so please spell this out. If you can't have common column(s), then you'll need to make a design change based on your requirements.

Upvotes: 0

Related Questions