SQL Server 数据库获取表名,字段名,与字段类型语句。方便导出到Excel中使用。
select a.name as columnname,b.name tablename ,
c.name typename,a.max_length,
a.precision,
a.scale
from sys.columns a,
sys.objects b,
sys.types c
where a.object_id=b.object_id
and a.user_type_id=c.user_type_id
and b.type='u'
--and c.name in('varchar','nvarchar','char','nchar','text','ntext')
--and object_name(a.object_id)<>'t'
order by b.name
SQLServer数据库获取表名、字段名与字段类型方法
本文介绍了如何通过SQL查询获取SQLServer数据库中的表名、字段名及字段类型,并导出至Excel,便于进一步的数据分析与管理。
897

被折叠的 条评论
为什么被折叠?



