logo

T-SQL : How to display fields for a table using information_schema

Overview: this code snippet demonstrates how to display fieldnames for a table by schema.
SELECT 'addr.'+COLUMN_NAME + ','
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'address' AND TABLE_SCHEMA='xx'
s