How to find all the column name from a database?

This helpful query will give you the list of tables:

SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
ORDER BY schema_name, table_name;

Web Reference
Ramani Sandeep’s Blog: Query to Find Column Name From All Tables

Leave A Reply

Your email address will not be published. Required fields are marked *