What is a Data Dictionary?

In SQL Server the data dictionary is a set of database tables used to store information about a database’s definition.  The dictionary contains information about database objects such as tables, indexes, columns, datatypes, and views.

The data dictionary is used by SQL Server to execute queries and is automatically updated whenever objects are added, removed, or changed within the database.

All the examples for this article are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database.  You can get started using these free tools using my Guide Getting Started Using SQL Server.

How SQL Server uses the Data Dictionary

SQL Server uses the database dictionary to verify SQL statements.  When you execute a SQL statement the DBMS (Database Management System) parses the statement and then determines whether the tables and fields you are referencing are valid.  To do this quickly it references the data dictionary.

In addition to testing the validity of statements, SQL Server uses the data dictionary to assist with query plan generation and to reference information defining the structure of the database.

The data dictionary becomes a guide book, per se, for SQL Server to use to access your data.  Simply put, without the data dictionary, though SQL Server would know and understand the SQL language, it wouldn’t know about your database tables and columns; therefore, it wouldn’t be able to query them.

Other Uses for the Data Dictionary

Since the data dictionary contains the definition of the database, it is a really good resource for you to use to gain information about the database.  The really cool thing is that the data dictionary is made up of SQL tables and views.  This means you can get information about the DB through queries!

Data dictionaries are used by designers and developers to understand the structure of the database.  You can think of the dictionary as an up-to-date reference document.

Design tools such as SQL Server Management Studio display information about the databases through the object explorer using the data dictionary.

SSMS Object Explorer
SQL Server Management Studio Object Explorer

The tables listed above aren’t magically known, rather, the object explorer issued a query to the data dictionary to retrieve all the user tables.

The data dictionary is stored in a series of system tables.  Though you can directly query these tables, Microsoft reserves the right to modify the system tables that make up the data dictionary.  Because of this, they recommend you query the INFORMATION_SCHEMA views as opposed to directly accessing the tables.

Since you can query the data dictionary yourself, you can answer some questions that would otherwise require a lot of hunting and pecking through object explorer.  For example, how can you easily find all the tables and views using the column BusinessEntityID?  Without the data dictionary, you’ll have to use object explorer and open each and every table and view and look through the definitions for the column.  However, using the data dictionary this can be done using a simple query.


The INFORMATION_SCHEMA views included in SQL Server comply with the SQL-92 ISO standard.  This means that other database vendors which comply with the ISO standard will supply the same set of views.

Here are some of the more commonly used views and their descriptions:

  • COLUMNS – Return one row for each column the current user has access to use in the current database. This view can be used to determine the data type and table the column is defined for use.
  • TABLES – Return one row for each table the users have access to use within the current database. Note, both tables and views are returned using the TABLES view.
  • VIEW_TABLE_USAGE – Return one row for each table that is used in a view within the current database.
  • VIEWS – Return one row for views that can be accessed using the currents user’s permissions from the current database.

Examples using INFORMATION_SCHEMA views

Listing all tables that include a specified column

You can do this by using INFORMATION_SCHEMA.COLUMNS view.   For instance the following lists all tables and views contain the column BusinessEntityID

WHERE  COLUMN_NAME = 'BusinessEntityID'

As you can imagine the data dictionary can come in handy!  Can you imagine having to search every definition by hand to find all the occurrence of a field within the database?

List all tables in a database

Use the INFORMATION_SCHEMA.TABLES view to do this.


This query returns both base tables as well as views.

List the Number of Tables in Each Schema

In this example each schema and the number of tables and views defined within them are listed:


SQL Server Catalog Views

The catalog views are another way to view the data dictionary.  I feel the object catalog views provide more information and I tend to use these views over the INFORMATION_SCHEMA views.

Some of the views I’ve found most useful include:

  • objects – contain a row for each object, such as a FOREIGN KEY or PRIMARY KEY constraint defined within the database.
  • columns – contain a row for each column of an object such as view or tables.
  • tables – return a row for each table object

Examples using Catalog Views

The following examples use the Microsoft SQL Server catalog views to obtain the same information use did so above using the INFORMATION_SCHEMA.

Listing all tables that include a specified column

In order to get the names of the tables using a specific column, both the sys.tables and sys.columns view must be used together.  They are joined via the object_id, which is used to identify common database objects such as tables and views.

SELECT     t.name,
FROM       AdventureWorks2012_Data.sys.columns AS c
INNER JOIN sys.tables AS t
           ON c.object_id = t.object_id
WHERE      c.name = 'BusinessEntityID'

List all tables in a database

The sys.tables view can be used to get names of all tables defined in the database.  This view returns both base tables and views.

SELECT   name,
FROM     AdventureWorks2012_Data.sys.tables

List Number of Tables in Each Schema

The sys.tables view doesn’t include a schema name, so the built-in function SCHEMA_NAME is used to obtain it.

SELECT   SCHEMA_NAME(schema_id),
FROM     AdventureWorks2012_Data.sys.tables

As you can see from the example, it a little more technical than using the INFORMATION_SCHEMA.  However, I say from experience that there is much more information contained in the catalog views…  If you have a particular question about the structure of a database, these are the table to hit.

Now that you know about the data dictionary what ideas do you have to utilize this great resource?  Leave a comment and share with us your ideas!

About the author 

Kris Wenzel

Kris Wenzel has been working with databases over the past 28 years as a developer, analyst, and DBA. He has a BSE in Computer Engineering from the University of Michigan and a MBA from the University of Notre Dame. Kris has written hundreds of blog articles and many online courses. He loves helping others learn SQL.

  • The write up was concise and detailed as well. It helped me get the grasp of the data Dictionary concept without taking much of my time. You are a gifted teacher Mr Kris.
    Thank you Sir.

  • Hi Kris,

    What if I need to display all information regarding all tables that are present in the current database. The output should contain all database tables, including those which were created by the system.

    Would something like this:

    SELECT *

    SELECT *

    Be enough to answer the question?

    Many thanks in advance :)

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}


    Nothing is worse than, being excited to learn a new tool but not knowing where to start, wasting time learning the wrong features, and being overwhelmed .

    But it doesn't have to be this way.

    I'm Putting together a free email course to help you get started learning SQL Server.

    __CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"b6728":{"name":"Main Accent","parent":-1},"03296":{"name":"Accent Low Opacity","parent":"b6728"}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"b6728":{"val":"var(--tcb-skin-color-0)"},"03296":{"val":"rgba(17, 72, 95, 0.5)","hsl_parent_dependency":{"h":198,"l":0.22,"s":0.7}}},"gradients":[]},"original":{"colors":{"b6728":{"val":"rgb(47, 138, 229)","hsl":{"h":210,"s":0.77,"l":0.54,"a":1}},"03296":{"val":"rgba(47, 138, 229, 0.5)","hsl_parent_dependency":{"h":210,"s":0.77,"l":0.54,"a":0.5}}},"gradients":[]}}]}__CONFIG_colors_palette__
    __CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"dffbe":{"name":"Main Accent","parent":-1}},"gradients":[]},"palettes":[{"name":"Default Palette","value":{"colors":{"dffbe":{"val":"var(--tcb-color-4)"}},"gradients":[]},"original":{"colors":{"dffbe":{"val":"rgb(19, 114, 211)","hsl":{"h":210,"s":0.83,"l":0.45}}},"gradients":[]}}]}__CONFIG_colors_palette__
    Sign Up