获取数据库中,所有用户表中每一列名和其数据类型。
select object_name(c.object_id) as [table_name], c.[name] as [column_name] ,t.[name] as [data_type_name] from sys.columns as c left join sysobjects as s on (c.[object_id] = s.[id]) left join sys.types as t on (c.[user_type_id]=t.[user_type_id]) where s.xtype = 'u'