Chapter 2. SQL Server tools for maintaining data integrity

Louis Davidson

You’ve probably seen it before: a client has called the help desk and reported that a couple of queries have seemingly inconsistent results. You’re called in to test the queries, so you start digging. You run two queries, and the results for one query don’t seem right, considering the other query’s results. So you start to wonder, “Is it my understanding of the schema?” You then start looking at the data model and the tables seem wonderfully designed. Your query should work. Dang, now what?

You dig deeper, and realize... the only objects you find in the database are tables. No constraints, no relationships, no nothing. A quick query later and you find that orphaned rows ...

Get SQL Server MVP Deep Dives 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.