Skip to content

Latest commit

 

History

History
94 lines (62 loc) · 3.72 KB

File metadata and controls

94 lines (62 loc) · 3.72 KB
title View the Dependencies of a Table | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service table-view-index, sql-database, sql-data-warehouse, pdw
ms.reviewer
ms.technology table-view-index
ms.topic conceptual
helpviewer_keywords
table dependencies [SQL Server]
dependencies [SQL Server], tables
displaying dependences
viewing dependencies
ms.assetid c4351ef5-e7d0-46e7-8367-88695e9974f8
author stevestein
ms.author sstein
monikerRange >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current

View the Dependencies of a Table

[!INCLUDEtsql-appliesto-ss2016-all-md]

You can view a table's dependencies in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql].

In This Topic

Before You Begin

Security

Permissions

Requires VIEW DEFINITION permission on the database and SELECT permission on sys.sql_expression_dependencies for the database. By default, SELECT permission is granted only to members of the db_owner fixed database role. When SELECT and VIEW DEFINITION permissions are granted to another user, the grantee can view all dependencies in the database.

Using SQL Server Management Studio

To view the dependencies of a table

  1. In Object Explorer, expand Databases, expand a database, and then expand Tables.

  2. Right-click a table, and then click View Dependencies.

  3. In the Object Dependencies<object name> dialog box, select either Objects that depend on <object name>, or Objects on which<object name>depends.

  4. Select an object in the Dependencies grid. The type of object (such as "Trigger" or "Stored Procedure"), appears in the Type box.

Using Transact-SQL

To view the objects that depend on a table

  1. In Object Explorer, connect to an instance of [!INCLUDEssDE].

  2. On the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute.

    USE AdventureWorks2012;  
    GO  
    SELECT * FROM sys.sql_expression_dependencies  
    WHERE referencing_id = OBJECT_ID(N'Production.vProductAndDescription');   
    GO  
    
    

To view the objects on which a table depends

  1. In Object Explorer, connect to an instance of [!INCLUDEssDE].

  2. On the Standard bar, click New Query.

  3. The following example returns the objects that depend on the table Production.Product. Copy and paste the following example into the query window and click Execute.

    USE AdventureWorks2012;   
    GO  
    SELECT * FROM sys.sql_expression_dependencies  
    WHERE referenced_id = OBJECT_ID(N'Production.Product');   
    GO  
    
    

For additional information, see sys.sql_expression_dependencies (Transact-SQL)