Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
How to find all the tables and views in a database
From Wiki
It is actually quite simple to list all the tables and/or views in your database, you can use the ANSI standars INFORMATION_SCHEMA.TABLE view. Here is what the query looks like
- USE PUBS
- GO
- --Get All Tables
- SELECT *
- FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_TYPE = 'BASE TABLE'
- GO
- --Get All Views
- SELECT *
- FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_TYPE = 'VIEW'
- GO
Contributed by: --SQLDenis 17:11, 7 June 2008 (GMT)
Part of SQL Server Admin Hacks



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.