Friday, December 28, 2007

How to: Get Table names and column names in SQL Server

1. Following Query displays all the table names.


Query : select name from sys.objects where type='u' ;

2. Following Query displays all the columns in a table

Query : select Table_Name,Column_Name from INFORMATION_SCHEMA.COLUMNS ;

No comments: