Lesson 45. Listing All Tables In A SQL Server Database

When you work with hundreds of tables, sometimes you lose track of things. This query will help you run a table down, plus the metadata is useful for dertermining if the table is still in use.

Examples

List All Tables

In [ ]:
USE AdventureWorks2016

SELECT
schema_name(schema_id) as schema_name,
name,
object_id,
create_date,
modify_date
FROM sys.Tables
ORDER BY name

Copyright © 2020, Mass Street Analytics, LLC. All Rights Reserved.