Tag Archives: Database Diagram

Maintaining Data Integrity Easily With SQL Server Relationship Cascade Delete & Update Rule

Maintaining Data Integrity Easily With SQL Server Relationship Cascade Delete & Update Rule

SQL Server provides relationship functionality that can be used to maintain data integrity.
Data Integrity means that all related tables data must have correct key value.
Take example of Header & Line tables. Header & Line have one to many relation with the key is Header ID. So each Header ID can have one or more records in Line table.
Please see screen shots:
tb_header Design:

tb_line Design:

Every header ID value inside Line table must exist in Header table. If there is header ID in Line table that does not exist in Header table then that data is junk.
Continue reading