SQL SERVER 2008 R2 – How to Get the List of All the Tables for All Databases Using System Tables Concept

To accomplish this task its simple with the below script :

sp_msforeachdb ‘select “?” AS db, * from [?].sys.tables’

By executing the Above script you can get a list of all the tables in all the databases in separate window.

Any Comments regarding this post is welcome.

Reference : Dilip Kumar Jena ( https://sqlexplore.wordpress.com )

Advertisements

SQL SERVER – 2008 R2 List of All the Tables in the Database

Sometimes We Require to see all the tables in the database, This can be achieved very Easily By the code below:

use AdventureWorksDW2008R2
GO
Select *
from sys.tables

This will return all the tables in the database.

Reference : Dilip Kumar Jena ( https://sqlexplore.wordpress.com )