II.5.2. Determining Dependencies

Dependencies refer to the interrelationships among objects in your database. A foreign key relationship is the most commonly encountered dependency.

As your database grows in size, it can be difficult to keep track of exactly which objects depend on other objects. Compounding this confusion is that these interdependencies often cascade throughout the database.

Fortunately, SQL Server makes it easy for you to untangle this potentially complicated picture. Here's how to do it:

  1. Launch the SQL Server Management Studio.

  2. Connect to the appropriate SQL Server instance.

  3. Expand the connection's entry in the Object Explorer view.

  4. Expand the Databases folder.

  5. Expand the Tables folder.

  6. Right-click the table you want to examine and choose View Dependencies.

You see a new dialog box that allows you to view both objects that depend on this table and objects upon which this table depends. Figure 5-3 shows an example of what this looks like.

Figure II.5-3. Dependencies for a given table displayed in the SQL Server Management Studio.

In this case, you can see that the payments and student_courses table depend on the students table. But wait, there's more! Expanding the payments table shows that the student_payments table also depends on the students table. Knowing these details helps you understand the potential ramifications of any database alterations. It's better ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® 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.