Jul 17, 2009

How to query MSSQL's Table information

To get all the table's name :

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';

3rd column shows the table name ..



To get the Table fields :

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'table_name';

4th column shows the table field name..

No comments: