SELECT
SCHEMA_NAME(t.[schema_id]) + '.' + t.name + '.' + c.name AS [Sch.Tbl.Col],
TYPE_NAME(c.user_type_id) AS [Type]FROM sys.columns AS cJOIN sys.tables AS t ON c.[object_id] = t.[object_id]WHERE c.max_length = -1
AND t.name NOT IN ('sysdiagrams')ORDER BY SCHEMA_NAME(t.[schema_id]) + '.' + t.name + '.' + c.name
Rob Garrison's writings on Data Architecture: Hadoop, SQL Server, performance, design, testing, best-practices, and automation.
Friday, June 22, 2012
List All Columns with MAX Length
To get a list of all columns in a database with "MAX" length, use this query:
Labels:
SQL,
SQL Server
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment