用视图
select A.object_ID,A.name as tablename,
B.name as columnname,c.name as typename,
b.max_length,b.scale
from sys.all_objects a,Sys.columns B,sys.types C
where a.object_ID = b.object_ID
and b.system_type_ID = c.system_type_ID
and a.type='U'
order by tablename
用表访问
select A.ID,A.name as tablename,
B.name as columnname,c.name as typename,
b.length,b.xscale
from DBO.sysobjects a,DBO.Syscolumns B,DBO.systypes C
where a.ID = b.ID
and b.xtype = c.xtype
and a.type='U'
order by tablename
ORACLE
SELECT column_name,data_type,data_length,data_Precision,Data_Scale FROM all_tab_columns WHERE table_name="表名"
本文介绍如何使用SQL查询数据库中表的结构信息,包括字段名称、数据类型及长度等,并提供了针对不同数据库系统的示例,如SQL Server和Oracle。
597

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



