Display Table Information

Display Table Information

This script displays all your table names&#151along with their column names, data types, data lengths, and null/not null information in a database.

SELECT AS TABLE_NAME, syscolumns.Id, AS COLUMN_NAME, AS DATA_TYPE, syscolumns.length as CHARACTER_MAXIMUM_LENGTH, sysproperties.[value] AS COLUMN_DESCRIPTION,  syscomments.text asCOLUMN_DEFAULT,syscolumns.isnullable as IS_NULLABLE FROM syscolumnsINNER JOIN systypes    ON syscolumns.xtype = systypes.xtype     LEFT JOIN sysobjects ON =    LEFT OUTER JOIN sysproperties ON    ( sysproperties.smallid = syscolumns.colid     AND =    LEFT OUTER JOIN syscomments ON syscolumns.cdefault =    WHERE IN      (SELECT id FROM SYSOBJECTS WHERE xtype = 'U') AND ( <> 'sysname')    ORDER BY syscolumns.colid
See also  11 Effective Keyword Research Tools and Techniques

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist