Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 list all table information in the db

Author  Topic 

rchiu5hk
Starting Member

7 Posts

Posted - 2008-12-15 : 21:47:02
How can the SQL be to withdraw all non system tables information such as table name, field name, field type, field size, nullable in the one schema db??
As if no solution, I need to desc for every table of total 100 tables.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-15 : 21:48:16
SELECT * FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM INFORMATION_SCHEMA.COLUMNS

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-15 : 23:53:29
if you're interested only in tables and want to exclude views then just add condition


SELECT t.table_name,c.* FROM INFORMATION_SCHEMA.COLUMNS c
JOIN INFORMATION_SCHEMA.TABLES t
ON t.TABLE_NAME=c.TABLE_NAME
WHERE t.TABLE_TYPE='BASE TABLE'
Go to Top of Page
   

- Advertisement -