SQL Server Cases: Dropped Relationships


Menu Expand/Collapse Menu

Using SQL Server 2000, I noticed on a few occasion that relationships between tables disappeared. At first I thought it was an omission or error on my part but it happened more than a few times. This made me nervous because orphans were turning up in tables which I had designed with rigorous referential integrity.

It was a complex database so visual inspection was inadequate for catching dropped relationships. So I wrote a relationship iteration routine to tally up relationships & report drops. The only other person who has direct access to relationships is the server administrator who is top notch.

This particular database uses transaction replication across 3 sites, one of which is a desktop PC which the client has ignored our pleas to upgrade to a server.


Code provided in screenshot for study only, hence no copy/paste.
SQL Server Cases