Those who want to see columns from base tables (rather than views) should join INFORMATION_SCHEMA.TABLES . I would also like to exclude the sysdiagrams system table.
Query
SELECT c.TABLE_NAME, COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS AS c JOIN INFORMATION_SCHEMA.TABLES AS t ON t.TABLE_NAME = c.TABLE_NAME WHERE is_nullable = 'YES' AND TABLE_TYPE = 'BASE TABLE' AND c.TABLE_NAME != 'sysdiagrams' ORDER BY c.TABLE_NAME, COLUMN_NAME
If you have duplicate table names between schemas or table directories, you should include these fields in the connection, as shown in the answers here:
Differentiation of tables and views in INFORMATION_SCHEMA.COLUMNS .
source share