Table and Column Details

This script gives a detailed information about tables and thier associated column properties for each database. This lists out Database name, owner name, table name, column name, data type, collation, etc. This is compatible to SQL 2000 and 2005.


EXECUTE master..sp_MSforeachdb @command1 ='select ''?'' as "DatabaseName", as "OwnerName", as "TableName", as "ColumnName", as "DataType",a.prec as "Precision", a.scale as "Scale",a.collation as "Collation"
from ?..syscolumns a,?..systypes b,?..sysobjects c, 
?..sysusers d where a.xtype = b.xtype and = and c.xtype = ''U''
and d.uid = c.uid and ''?'' not like ''tempdb'' order by TableName,ColumnName' 

Leave a Reply

Leave a comment

Your email address will not be published. Required fields are marked *