Managing Referential Integrity with Triggers

Referential integrity (RI) is used to preserve the defined relationships between tables when rows are inserted or deleted. In SQL Server 2000, referential integrity is based on the relationships between foreign keys and primary keys or between foreign keys and unique keys defined on tables in a database. This process ensures that key values are consistent across all tables in the database. This requires that there are no references to nonexistent values and, if a key value changes, all references to it change consistently throughout the database. When you enforce referential integrity in your database, SQL Server prevents users from

  • Adding records to a related table if there is no associated record ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.