Skip to main content

Snippet: Show full column names and data types for all user tables in a database

SELECT QUOTENAME( sysobjects.name ) + ‘.’ + QUOTENAME( USER_NAME( sysobjects.uid ) ) + ‘.’ + QUOTENAME( syscolumns.name ) AS [Name] , TYPE_NAME( syscolumns.xusertype ) AS [Type] , syscolumns.prec AS [Precision] , syscolumns.scale AS [Scale] FROM syscolumnsINNER JOIN sysobjects ON syscolumns.id = sysobjects.idLEFT OUTER JOIN systypes ON systypes.xtype = syscolumns.xtypeWHERE sysobjects.xtype = ‘U’

Read More