Thursday, February 13, 2014

SQL List of all Column Names

Sometimes I need to find a field in the database and have no idea where to look. This query pulls back all column names in the database.

SELECT t.name AS table_name,SCHEMA_NAME(schema_idAS schema_name,c.name AS column_name FROM sys.tables AS INNER JOIN sys.columns c ON t.OBJECT_ID c.OBJECT_ID


No comments:

Post a Comment